| Mirage Source http://www.miragesource.net/forums/ |
|
| Spell animations fix when target dies http://www.miragesource.net/forums/viewtopic.php?f=184&t=5170 |
Page 1 of 11 |
| Author: | GIAKEN [ Tue Mar 03, 2009 11:26 pm ] |
| Post subject: | Spell animations fix when target dies |
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: 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 |
|
| Author: | Robin [ Tue Mar 03, 2009 11:49 pm ] |
| Post subject: | Re: Spell animations fix when target dies |
Works. To fix another bug, change: Code: The spell was to weak to hurt To: Code: The spell was too weak to hurt ;D |
|
| Author: | Matt [ Wed Mar 04, 2009 12:10 am ] |
| Post subject: | Re: Spell animations fix when target dies |
Not a bug, that's a grammar mistake.. |
|
| Author: | Robin [ Wed Mar 04, 2009 12:37 am ] |
| Post subject: | Re: Spell animations fix when target dies |
Just realised this won't work ;D It'll now try and attack a player no matter what spell you use. Marked it as broken so no one uses it whilst you're away, because they might not no where to put the original code back ;D |
|
| Author: | GIAKEN [ Wed Mar 04, 2009 1:56 am ] |
| Post subject: | Re: [fixed] Spell animations fix when target dies |
Fixed. |
|
| Author: | Tony [ Wed Mar 04, 2009 3:29 am ] |
| Post subject: | Re: [fixed] Spell animations fix when target dies |
Ironic. The fix was fixed. |
|
| Author: | Matt [ Wed Mar 04, 2009 3:37 am ] |
| Post subject: | Re: [fixed] Spell animations fix when target dies |
Hopefully the fix that was fixed, doesn't need fixed. |
|
| Author: | Pbcrazy [ Wed Mar 04, 2009 3:43 am ] |
| Post subject: | Re: [fixed] Spell animations fix when target dies |
if it needed a new fix, then the fix that was fixed and requires a new fix, would have to be re-broken. |
|
| Author: | Matt [ Wed Mar 04, 2009 3:52 am ] |
| Post subject: | Re: [fixed] Spell animations fix when target dies |
Pbcrazy wrote: if it needed a new fix, then the fix that was fixed and requires a new fix, would have to be re-broken. Shut up. You suck. |
|
| Author: | GIAKEN [ Wed Mar 04, 2009 5:12 am ] |
| Post subject: | Re: [fixed] Spell animations fix when target dies |
wut |
|
| Author: | Matt [ Tue Mar 17, 2009 4:57 pm ] |
| Post subject: | Re: Spell animations fix when target dies |
I've never seen it blit in the top right, however, I know if you kill an npc, it will still have the animation on it when it respawns. To fix that, client side, in Sub HandleSpawnNpc, at the bottom, add this: Code: For i = 1 To MAX_SPELLANIM
MapNpc(n).SpellAnimations(i).SpellNum = 0 Next |
|
| Author: | GIAKEN [ Tue Mar 17, 2009 5:11 pm ] |
| Post subject: | Re: Spell animations fix when target dies |
Oh I meant to the top left. Because before it did the attacking before the animation, so if the NPC died it's position would be 0x 0y so I moved it to after. |
|
| Author: | Matt [ Tue Mar 17, 2009 5:28 pm ] |
| Post subject: | Re: Spell animations fix when target dies |
GIAKEN wrote: Oh I meant to the top left. Because before it did the attacking before the animation, so if the NPC died it's position would be 0x 0y so I moved it to after. I never see it up there either. O.o |
|
| Author: | GIAKEN [ Tue Mar 17, 2009 5:35 pm ] |
| Post subject: | Re: Spell animations fix when target dies |
Oh...well maybe it was just for my engine. I did the animation system differently...not based on Player or NPC. |
|
| Author: | Matt [ Tue Mar 17, 2009 5:44 pm ] |
| Post subject: | Re: Spell animations fix when target dies |
GIAKEN wrote: Oh...well maybe it was just for my engine. I did the animation system differently...not based on Player or NPC. Maybe. My fix I posted is still useful. Without it, the npc will spawn and the animation will play out once. |
|
| Author: | Avarit [ Mon Apr 06, 2009 4:40 am ] |
| Post subject: | Re: Spell animations fix when target dies |
maybe its me but when i open the /editspell i get a error 9 or w/e with Code: Private Sub scrlFrame_Change()
lblFrameNum.Caption = scrlFrame.Value Call SpellEditorBltSpell frmSpellEditor.scrlFrame.Max = (DDS_Spell(scrlFrame.Value).SurfDescription.lWidth \ SIZE_X) - 1 End Sub |
|
| Author: | GIAKEN [ Mon Apr 06, 2009 4:44 am ] |
| Post subject: | Re: Spell animations fix when target dies |
DDS_Spell(scrlFrame.Value) scrlFrame.Value is exceeding the DDS_Spell's limits. I haven't looked at the newest MS4, but find: DDS_Spell(1 To Not sure what it's set as, but make sure that the scroll bar's max doesn't go over the max value DDS_Spell can hold. |
|
| Page 1 of 11 | All times are UTC |
| Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |
|