Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

AOE Spell


Broken_Paladin
 Share

Recommended Posts

I'm trying to create a scripted AOE spell that plays an animation on all the targets in a few square range and plays a sound.  However I tried writing this up but I don't think I did something right, any pointers or suggestions.

```
Dim Target
Dim npcnum

  Sub ScriptedSpell(Index, Script)
  Select Case Script
      Case 0
        npcnum = GetPlayerTargetNPC(Index)
      Call PlaySound(index, "spell1.wav")
  If Int(Damage) > 0 Then
      If Int(GetPlayerTarget(Index)) > 0 Then
        Target = GetPlayerTarget(Index)
        Call DamagePlayer(Index, Target, Damage)
      Else
        Target = GetPlayerTargetNPC(Index)
        Call DamageNPC(Index, Target, Damage)
      End If       

Exit Sub

      Case Else
        Call PlayerMsg(Index, "No spell script found. Please contact an admin to solve this problem.", WHITE)
        Exit Sub
  End Select
End Sub

```

I'm trying to find the function I think to do AOE foes, AOE allies, self. Is what im not getting a good grasp on.
Link to comment
Share on other sites

I'm using 2.7 and able to buff myself, trying to get the target buff/debuff to work to no avail. (Case 3 spell) Any suggestions or fixes I would appreciate, if the targeting won't work what would you suggest to make it AOE.

```
' Executes whenever a player casts a scripted spell.
Sub ScriptedSpell(Index, Script)
  Select Case Script
      Case 0
        Call PlayerMsg(Index, "This scripted spell has no apparent use.", WHITE)
        Exit Sub

      Case 1
            Call PlayerMsg(Index, "Test 1.", WHITE)

      Exit Sub 

            Case 2
            call StartRipple(index, 5, 5, 2, 75)
Exit sub
          Case 3 
If GetPlayerTarget(index) > 0 Then
Dim addblah
Dim playermag
playermag = GetPlayerMAGI(index) / 2
b = (int(playermag))

Call StatBoost(index, 0, b, b, 0, 5)
End If
End Select
Exit Sub
```

```
Sub StatBoost(index, str, def, spd, mag, time)

dim inuse
dim playerstr
dim playerdef
dim playerspd
dim playermag

inuse = GetVar("Scripts\Charextras\" & GetPlayerName(index) & ".ini", "StatBoost", "using")

playerstr = GetPlayerSTR(index)
playerdef = GetPlayerDEF(index)
playerspd = GetPlayerSPEED(index)
playermag = GetPlayerMAGI(index)

if inuse = "" then

if int(str) > 0 then
Call BattleMsg(index, "Your strength has been boosted by " & str, 14, 1)
end if
if int(def) > 0 then
Call BattleMsg(index, "Your defense has been boosted by " & def, 14, 1)
end if
if int(spd) > 0 then
Call BattleMsg(index, "Your speed has been boosted by " & spd, 14, 1)
end if
if int(mag) > 0 then
Call BattleMsg(index, "Your magic has been boosted by " & mag, 14, 1)
end if

Call PutVar("Scripts\Charextras\" & GetPlayerName(index) & ".ini", "StatBoost", "using", 1)
Call PutVar("Scripts\Charextras\" & GetPlayerName(index) & ".ini", "StatBoost", "str", "" & str)
Call PutVar("Scripts\Charextras\" & GetPlayerName(index) & ".ini", "StatBoost", "def", "" & def)
Call PutVar("Scripts\Charextras\" & GetPlayerName(index) & ".ini", "StatBoost", "spd", "" & spd)
Call PutVar("Scripts\Charextras\" & GetPlayerName(index) & ".ini", "StatBoost", "mag", "" & mag)
Call SetPlayerSTR(index, int(playerstr) + int(str))
Call SetPlayerDEF(index, int(playerdef) + int(def))
Call SetPlayerSPEED(index, int(playerspd) + int(spd))
Call SetPlayerMagi(index, int(playermag) + int(mag))
Call SendStats(index)
Call SetTimer("StatRelease " & index & "," & str & "," & def & "," & spd & "," & mag, int(time * 1000))

else

Call PlayerMsg(index, "You're already boosted!", 15)

end if

end sub

Sub StatRelease(index, str, def, spd, mag)
dim inuse
dim playerstr
dim playerdef
dim playerspd
dim playermag 

inuse = GetVar("Scripts\Charextras\" & GetPlayerName(index) & ".ini", "StatBoost", "using")

playerstr = GetPlayerSTR(index)
playerdef = GetPlayerDEF(index)
playerspd = GetPlayerSPEED(index)
playermag = GetPlayerMAGI(index)

if inuse = "1" then

Call BattleMsg(index, "The effects of you ability increase has worn off.", 4, 1)

Call PutVar("Scripts\Charextras\" & GetPlayerName(index) & ".ini", "StatBoost", "using", "")

Call SetPlayerSTR(index, int(playerstr) - int(str))
Call SetPlayerDEF(index, int(playerdef) - int(def))
Call SetPlayerSPEED(index, int(playerspd) - int(spd))
Call SetPlayerMagi(index, int(playermag) - int(mag))
Call SendStats(index)

Call RemoveTimer("StatRelease " & index & "," & str & "," & def & "," & spd & "," & mag)

else

Call PlayerMsg(index, "You're not boosted!", 15)

end if

end sub
```
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...