'~~~~~~~~~~~~~~~~~'Epic Spell'Made by Admiral Refuge'Special thanks to Shadowwulf for range-detection algorithm'Give credit where credit is due.'~~~~~~~~~~~~~~~~~Sub dmgspell(index, mp, val, range, ani, sound) If GetPlayerMP(index) >= mp Then Dim target Dim x Dim y Dim map map = GetPlayerMap(index) If GetPlayerTarget(index) < 0 Then target = GetPlayerTargetNpc(index) y = GetNpcY(map, target) x = GetNpcX(map, target) If CanSpell(index, target, range, x, y) = False Then Call PlayerMsg(index, "You are too far from the target!", 1) Exit Sub End If Call DamageNPC(index, target, val) Call SpellAnim(ani, map, x, y) Call PlaySound(index, sound) Else target = GetPlayerTarget(index) y = GetPlayerY(target) x = GetPlayerX(target) If CanSpell(index, target, range, x, y) = False Then Call PlayerMsg(index, "You are too far from the target!", 1) Exit Sub End If Call DamagePlayer(index, target, val) Call SpellAnim(ani, map, x, y) Call PlaySound(index, sound) End If mp = GetPlayerMP(index) - mp Call SetPlayerMP(index, mp) Else Call PlayerMsg(index, "You need " & mp & " MP to cast this spell!", 1) End IfEnd SubSub curespell(index, mp, val, range, ani, sound) If GetPlayerMP(index) >= mp Then Dim target Dim x Dim y Dim map Dim hp map = GetPlayerMap(index) If GetPlayerTarget(index) > 0 Then target = GetPlayerTarget(index) y = GetPlayerY(target) x = GetPlayerX(target) hp = GetPlayerHP(target) val = val + hp If CanSpell(index, target, range, x, y) = False Then Call PlayerMsg(index, "You are too far from the target!", 1) Exit Sub End If Call SetPlayerHP(target, val) Call SpellAnim(ani, map, x, y) Call PlaySound(index, sound) Else target = GetPlayerTargetNpc(index) y = GetNpcY(map, target) x = GetNpcX(map, target) hp = GetMapNpcHP(map, target) val = val - hp If CanSpell(index, target, range, x, y) = False Then Call PlayerMsg(index, "You are too far from the target!", 1) Exit Sub End If Call SetMapNpcHP(map, target, val) Call SendNPC(map, target) Call SpellAnim(ani, map, x, y) Call PlaySound(index, sound) End If mp = GetPlayerMP(index) - mp Call SetPlayerMP(index, mp) Else Call PlayerMsg(index, "You need " & mp & " MP to cast this spell!", 1) End IfEnd SubSub warmthspell(index, mp, val, range, ani, sound) If GetPlayerMP(index) >= mp Then Dim target Dim x Dim y Dim map Dim mp1 map = GetPlayerMap(index) If GetPlayerTarget(index) > 0 Then target = GetPlayerTarget(index) y = GetPlayerY(target) x = GetPlayerX(target) mp1 = GetPlayerMP(index) val = val + mp1 - mp If CanSpell (index, target, range, x, y) = False Then Call PlayerMsg(index, "You are too far from the target!", 1) Exit Sub End If Call SetPlayerMP(target, val) Call SpellAnim(ani, map, x, y) Call PlaySound(index, sound) Else Call PlayerMsg(index, "You cannot cast this on an NPC", 1) End If Else Call PlayerMsg(index, "You need " & mp & " MP to cast this spell!", 1) End IfEnd SubSub burstspell(index, mp, val, range, ani, sound) If GetPlayerMP(index) >= mp Then Dim target Dim x Dim y Dim map Dim sp map = GetPlayerMap(index) If GetPlayerTarget(index) > 0 Then target = GetPlayerTarget(index) y = GetPlayerY(target) x = GetPlayerX(target) sp = GetPlayerSP(target) mp = GetPlayerMP(index) - mp val = val + sp If CanSpell (index, target, range, x, y) = False Then Call PlayerMsg(index, "You are too far from the target!", 1) Exit Sub End If Call SetPlayerSP(target, val) Call SpellAnim(ani, map, x, y) Call PlaySound(index, sound) Call SetPlayerMP(index, mp) Else Call PlayerMsg(index, "You cannot cast this on an NPC", 1) End If Else Call PlayerMsg(index, "You need " & mp & " MP to cast this spell!", 1) End IfEnd SubSub physchespell(index, mp, val, range, ani, sound) If GetPlayerMP(index) >= mp Then Dim target Dim x Dim y Dim map Dim mp1 map = GetPlayerMap(index) If GetPlayerTarget(index) > 0 Then target = GetPlayerTarget(index) y = GetPlayerY(target) x = GetPlayerX(target) mp = GetPlayerMP(index) - mp If CanSpell (index, target, range, x, y) = False Then Call PlayerMsg(index, "You are too far from the target!", 1) Exit Sub End If Call SetPlayerMP(index, mp) mp1 = GetPlayerMP(target) val = mp1 - val Call SetPlayerMP(target, val) Call SpellAnim(ani, map, x, y) Call PlaySound(index, sound) Else Call PlayerMsg(index, "You cannot cast this on an NPC", 1) End If Else Call PlayerMsg(index, "You need " & mp & " MP to cast this spell!", 1) End IfEnd SubFunction CanSpell(index, target, range, x, y) Dim PX Dim PY PX = GetPlayerX(index) PY = GetPlayerY(index) If target = GetPlayerTargetNpc(index) Then If x > PX + range Or x < PX - range Then CanSpell = False Exit Function End If If y > PY + range Or y < PY - range Then CanSpell = False Exit Function End If CanSpell = True Exit Function Else If GetPlayerMap(index) <> GetPlayerMap(target) Then CanSpell = False Exit Function End If If x > PX + range Or x < PX - range Then CanSpell = False Exit Function End If If y > PY + range Or y < PY - range Then CanSpell = False Exit Function End If CanSpell = True Exit Function End IfEnd Function
Call dmgspell(index, mp, val, range, ani, sound)
Call curespell(index, mp, val, range, ani, sound)
Call warmthspell(index, mp, val, range, ani, sound)
Call physchespell(index, mp, val, range, ani, sound)
Call burstspell(index, mp, val, range, ani, sound)
Call slowspell(index, mp, val, range, ani, sound)
' 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 Else Call PlayerMsg(Index, "No spell script found. Please contact an admin to solve this problem.", WHITE) Exit Sub End SelectEnd Sub
' Executes whenever a player casts a scripted spell.Sub ScriptedSpell(Index, Script) Select Case Script Case 0 Call dmgspell(index, 5, 10, 3, 2, "magic1.wav") Exit Sub Case Else Call PlayerMsg(Index, "No spell script found. Please contact an admin to solve this problem.", WHITE) Exit Sub End SelectEnd Sub
' Executes whenever a player casts a scripted spell.Sub ScriptedSpell(Index, Script) Select Case Script Case 0 Call dmgspell(index, 5, 10, 3, 2, "magic1.wav") Exit Sub Case 1 Call curespell(index, mp, val, range, ani, sound) Exit Sub Case Else Call PlayerMsg(Index, "No spell script found. Please contact an admin to solve this problem.", WHITE) Exit Sub End SelectEnd Sub
Remember that marshmallow from Ghost Busters? marsh is a Canadian version of that.
Hello! I am French and I have found my happiness on your software.
So this is a sub you put at the end of the main and call up using Sub Epicspell(ani, etc, etc) ?Or do you plan on using this is scripted spell sub and call up using select, I think you mean at the bottom but not sure...
You scare me. Nuff said
WHEN ALL ELSE FAILS, USE TASK MANAGER! - Hippoman 7-8-09.
very good script man !but the only prblem is: the distance!the spell has unlimeted distance and hit the taget if its out of screen
Where/How I use "Calls"
' Executes whenever a player casts a scripted spell.Sub ScriptedSpell(Index, Script) Select Case Script Case 0 Call dmgspell(index, 5, 10, 2, "magic1.wav") Exit Sub Case Else Call PlayerMsg(Index, "No spell script found. Please contact an admin to solve this problem.", WHITE) Exit Sub End SelectEnd Sub
' Executes whenever a player casts a scripted spell.Sub ScriptedSpell(Index, Script) Select Case Script Case 0 Call dmgspell(index, 5, 10, 2, "magic1.wav") Exit Sub Case 1 Call curespell(index, mp, val, ani, sound) Exit Sub Case Else Call PlayerMsg(Index, "No spell script found. Please contact an admin to solve this problem.", WHITE) Exit Sub End SelectEnd Sub
If you were to put #include<epicspells.txt> where exactly would you put it?-Alpha
The spells work, but there's no animation, is there any way to fix it?-Alpha
Okay, thanks Admiral! I was using the Source spells work version.-Alpha