Guest Posted February 3, 2013 Share Posted February 3, 2013 There's a bug in EO that causes NPCs' health to increase above their max health. All of this code is serverside.Replace your Sub SpellNPC_Effect with this:```Public Sub SpellNpc_Effect(ByVal Vital As Byte, ByVal increment As Boolean, ByVal index As Long, ByVal Damage As Long, ByVal spellnum As Long, ByVal mapNum As Long)Dim sSymbol As String * 1Dim Colour As Long If Damage > 0 Then If increment Then sSymbol = "+" If Vital = Vitals.HP Then Colour = BrightGreen If Vital = Vitals.mp Then Colour = BrightBlue Else sSymbol = "-" Colour = Blue End If SendAnimation mapNum, Spell(spellnum).SpellAnim, 0, 0, TARGET_TYPE_NPC, index SendActionMsg mapNum, sSymbol & Damage, Colour, ACTIONMSG_SCROLL, MapNpc(mapNum).Npc(index).x * 32, MapNpc(mapNum).Npc(index).y * 32 ' send the sound SendMapSound index, MapNpc(mapNum).Npc(index).x, MapNpc(mapNum).Npc(index).y, SoundEntity.seSpell, spellnum If increment Then If MapNpc(mapNum).Npc(index).Vital(Vital) + Damage <= GetNpcMaxVital(index, Vitals.HP) Then MapNpc(mapNum).Npc(index).Vital(Vital) = MapNpc(mapNum).Npc(index).Vital(Vital) + Damage Else MapNpc(mapNum).Npc(index).Vital(Vital) = GetNpcMaxVital(index, Vitals.HP) End If If Spell(spellnum).Duration > 0 Then AddHoT_Npc mapNum, index, spellnum End If ElseIf Not increment Then MapNpc(mapNum).Npc(index).Vital(Vital) = MapNpc(mapNum).Npc(index).Vital(Vital) - Damage End If End IfEnd Sub```And your HandleHoT_NPC with this:```Public Sub HandleHoT_Npc(ByVal mapNum As Long, ByVal index As Long, ByVal hotNum As Long) With MapNpc(mapNum).Npc(index).HoT(hotNum) If .Used And .Spell > 0 Then ' time to tick? If GetTickCount > .Timer + (Spell(.Spell).Interval * 1000) Then If Spell(.Spell).Type = SPELL_TYPE_HEALHP Then SendActionMsg mapNum, "+" & Spell(.Spell).Vital, BrightGreen, ACTIONMSG_SCROLL, MapNpc(mapNum).Npc(index).x * 32, MapNpc(mapNum).Npc(index).y * 32 MapNpc(mapNum).Npc(index).Vital(Vitals.HP) = MapNpc(mapNum).Npc(index).Vital(Vitals.HP) + Spell(.Spell).Vital If MapNpc(mapNum).Npc(index).Vital(Vitals.HP) > GetNpcMaxVital(index, Vitals.HP) Then MapNpc(mapNum).Npc(index).Vital(Vitals.HP) = GetNpcMaxVital(index, Vitals.HP) End If Else SendActionMsg mapNum, "+" & Spell(.Spell).Vital, BrightBlue, ACTIONMSG_SCROLL, MapNpc(mapNum).Npc(index).x * 32, MapNpc(mapNum).Npc(index).y * 32 MapNpc(mapNum).Npc(index).Vital(Vitals.mp) = MapNpc(mapNum).Npc(index).Vital(Vitals.mp) + Spell(.Spell).Vital If MapNpc(mapNum).Npc(index).Vital(Vitals.mp) > GetNpcMaxVital(index, Vitals.mp) Then MapNpc(mapNum).Npc(index).Vital(Vitals.mp) = GetNpcMaxVital(index, Vitals.mp) End If End If .Timer = GetTickCount ' check if DoT is still active - if NPC died it'll have been purged If .Used And .Spell > 0 Then ' destroy hoT if finished If GetTickCount - .StartTime >= (Spell(.Spell).Duration * 1000) Then .Used = False .Spell = 0 .Timer = 0 .Caster = 0 .StartTime = 0 End If End If End If End If End WithEnd Sub``` Link to comment Share on other sites More sharing options...
Larias Posted February 3, 2013 Share Posted February 3, 2013 I love you. Link to comment Share on other sites More sharing options...
abhi2011 Posted February 4, 2013 Share Posted February 4, 2013 A long time bug I believe. And a long awaited fix also. Link to comment Share on other sites More sharing options...
Alerd Posted February 4, 2013 Share Posted February 4, 2013 This fix work on ea ?Variabe not defined(mapNum) Link to comment Share on other sites More sharing options...
Guest Posted February 4, 2013 Share Posted February 4, 2013 Probably but I'm not going to help you fix a broken mess. Link to comment Share on other sites More sharing options...
erkro1 Posted February 4, 2013 Share Posted February 4, 2013 A better way of doing it is this:```If MapNpc(mapNum).Npc(index).Vital(Vital) + Damage > thenMapNpc(mapNum).Npc(index).Vital(Vital) = MapNpc(mapNum).Npc(index).Vital(Vital)elseMapNpc(mapNum).Npc(index).Vital(Vital) = MapNpc(mapNum).Npc(index).Vital(Vital) + DamageEnd If```Else it wouldn't heal anything is the full heal will go over the NPC's max health. ![;)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/wink.png) Link to comment Share on other sites More sharing options...
Guest Posted February 4, 2013 Share Posted February 4, 2013 Oh yeah, woops, didn't notice that. Thanks xD. Link to comment Share on other sites More sharing options...
Larias Posted February 4, 2013 Share Posted February 4, 2013 > A better way of doing it is this:> > ```> If MapNpc(mapNum).Npc(index).Vital(Vital) + Damage > then> > MapNpc(mapNum).Npc(index).Vital(Vital) = MapNpc(mapNum).Npc(index).Vital(Vital)> > else> > MapNpc(mapNum).Npc(index).Vital(Vital) = MapNpc(mapNum).Npc(index).Vital(Vital) + Damage> > End If> ```> > Else it wouldn't heal anything is the full heal will go over the NPC's max health. ![;)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/wink.png)Syntax error onIf MapNpc(mapNum).NPC(index).Vital(Vital) + Damage > thenYou meant> A better way of doing it is this:> > ```> If MapNpc(mapNum).Npc(index).Vital(Vital) + Damage > MapNpc(mapNum).Npc(index).Vital(Vital) then> > MapNpc(mapNum).Npc(index).Vital(Vital) = MapNpc(mapNum).Npc(index).Vital(Vital)> > else> > MapNpc(mapNum).Npc(index).Vital(Vital) = MapNpc(mapNum).Npc(index).Vital(Vital) + Damage> > End If> ```**EDIT**: Which doesn't workTrying to figure out how to put GetNpcMaxVital(npcNum, Vitals.HP) in there Link to comment Share on other sites More sharing options...
Larias Posted February 4, 2013 Share Posted February 4, 2013 Dangit, sorry for double post. No delete button I can find.Would this work?```MapNpc(mapNum).Npc(index).Vital(Vital) = MapNpc(mapNum).Npc(index).Vital(Vital) + DamageIf MapNpc(mapNum).NPC(index).Vital(Vitals.HP) > GetNpcMaxVital(npcNum, Vitals.HP) ThenMapNpc(mapNum).NPC(index).Vital(Vitals.HP) = GetNpcMaxVital(npcNum, Vitals.HP)```Nope…GRRRRR..**FINAL EDIT IN RAGE.**Okay, I got tired of ducking around with it, so I edited Case 2 'targetted in CastSpell and did this> If targetType = TARGET_TYPE_PLAYER Then> > x = GetPlayerX(target)> > y = GetPlayerY(target)> > Else> > Exit Sub> > End IfSo you can't heal NPCs at all.I also commented out the AoE heal part just above it:> 'For i = 1 To MAX_MAP_NPCS> > ' If MapNpc(mapNum).NPC(i).Num > 0 Then> > ' If MapNpc(mapNum).NPC(i).Vital(HP) > 0 Then> > ' If isInRange(AoE, x, y, MapNpc(mapNum).NPC(i).x, MapNpc(mapNum).NPC(i).y) Then> > ' SpellNpc_Effect VitalType, increment, i, Vital, spellnum, mapNum> > ' End If> > ' End If> > ' End If> > 'Next Link to comment Share on other sites More sharing options...
Guest Posted February 5, 2013 Share Posted February 5, 2013 ```If MapNpc(mapNum).NPC(index).Vital(Vitals.HP) > GetNpcMaxVital(index, Vitals.HP) Then```Would work. I'll edit the post later with a rewritten sub.EDIT: Updated. Link to comment Share on other sites More sharing options...
Alerd Posted March 20, 2013 Share Posted March 20, 2013 Very thanx for this fix Link to comment Share on other sites More sharing options...
escfoe2 Posted March 22, 2013 Share Posted March 22, 2013 Nicely done. Link to comment Share on other sites More sharing options...
Valentine90 Posted March 26, 2013 Share Posted March 26, 2013 Good, I liked, I love fix Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now