03-03-2009, 11:26 PM
Well as you may have noticed, if you kill a player or NPC with a spell and that target dies, the spell animation appears in the top left. To fix this we need to kill the player / npc AFTER you send the animation data. To do this it's simple:
Server side:
Find:
Under add:
Find (Sub CastSpell):
And remove it. Then find (Sub CastSpell):
And remove it. Find:
Find:
Under add:
Find:
Under add:
Find:
Under add:
That should be it
I'm in a hurry...gotta go in 5 minutes. So if anybody has any problems post
Server side:
Find:
Code:
Public Sub CastSpell(ByVal Index As Long, ByVal SpellSlot As Long)
Dim SpellNum As Long
Dim MPReq As Long
Dim i As Long
Dim n As Long
Dim Damage As Long
Dim Casted As Boolean
Dim CanCast As Boolean
Dim ErrorMessage As String
Dim TargetType As Byte
Dim TargetName As String
Under add:
Code:
Damage = -1
Find (Sub CastSpell):
Code:
If Damage > 0 Then
Call AttackPlayer(Index, n, Damage)
Else
Call PlayerMsg(Index, "The spell was to weak to hurt " & GetPlayerName(n) & "!", BrightRed)
End If
And remove it. Then find (Sub CastSpell):
Code:
If Damage > 0 Then
Call AttackNpc(Index, n, Damage)
Else
Call PlayerMsg(Index, "The spell was to weak to hurt " & Trim$(Npc(MapNpc(GetPlayerMap(Index), n).Num).Name) & "!", BrightRed)
End If
And remove it. Find:
Find:
Code:
Damage = (GetPlayerStat(Index, Stats.Magic) \ 4) + Spell(SpellNum).Data1 - GetPlayerProtection(n)
Under add:
Code:
If Damage < 0 Then Damage = 0
Find:
Code:
Damage = (GetPlayerStat(Index, Stats.Magic) \ 4) + Spell(SpellNum).Data1 - (Npc(MapNpc(GetPlayerMap(Index), n).Num).Stat(Stats.Defense) \ 2)
Under add:
Code:
If Damage < 0 Then Damage = 0
Find:
Code:
Call SendDataToMap(GetPlayerMap(Index), SCastSpell & SEP_CHAR & TargetType & SEP_CHAR & n & SEP_CHAR & SpellNum & END_CHAR)
Under add:
Code:
If Damage -1 Then
Select Case TargetType
Case TARGET_TYPE_PLAYER
If Damage > 0 Then
Call AttackPlayer(Index, n, Damage)
Else
Call PlayerMsg(Index, "The spell was to weak to hurt " & TargetName & "!", BrightRed)
End If
Case TARGET_TYPE_NPC
If Damage > 0 Then
Call AttackNpc(Index, n, Damage)
Else
Call PlayerMsg(Index, "The spell was to weak to hurt " & TargetName & "!", BrightRed)
End If
End Select
End If
That should be it

