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

[EO] Healing Spell with Intervals Fix


escfoe2
 Share

Recommended Posts

Ever made a spell that heals the caster over time? I know I have, and it shows the +00 in green floating up from your forehead every second or however long you set the interval, but it doesn't change your health. Crappy issue, but I'll show you how to fix it.

1) In Server>modCombat>SpellPlayer_Effect you'll need to add some things. To make it easier for you simply change this:

```

If increment Then

SetPlayerVital index, Vital, GetPlayerVital(index, Vital) + Damage

If Spell(spellnum).Duration > 0 Then

AddHoT_Player index, spellnum

End If

ElseIf Not increment Then

SetPlayerVital index, Vital, GetPlayerVital(index, Vital) - Damage

End If

```

To This:

```

If increment Then

SetPlayerVital index, Vital, GetPlayerVital(index, Vital) + Damage

DoEvents

SendVital index, HP

If Spell(spellnum).Duration > 0 Then

AddHoT_Player index, spellnum

End If

ElseIf Not increment Then

SetPlayerVital index, Vital, GetPlayerVital(index, Vital) - Damage

DoEvents

SendVital index, HP

End If

```

The main issue isn't that it's not healing you, only that it's not updating your health. Hang on though, we're not done yet.

2) In Server>modCombat>HandleHoT_Player change this:

```

' time to tick?

If GetTickCount > .Timer + (Spell(.Spell).Interval * 1000) Then

If Spell(.Spell).Type = SPELL_TYPE_HEALHP Then

SendActionMsg Player(index).Map, "+" & Spell(.Spell).Vital, BrightGreen, ACTIONMSG_SCROLL, Player(index).x * 32, Player(index).y * 32

SetPlayerVital index, Vitals.HP, GetPlayerVital(index, Vitals.HP) + Spell(.Spell).Vital

Else

SendActionMsg Player(index).Map, "+" & Spell(.Spell).Vital, BrightBlue, ACTIONMSG_SCROLL, Player(index).x * 32, Player(index).y * 32

SetPlayerVital index, Vitals.MP, GetPlayerVital(index, Vitals.MP) + Spell(.Spell).Vital

End If

```

To this:

```

' time to tick?

If GetTickCount > .Timer + (Spell(.Spell).Interval * 1000) Then

If Spell(.Spell).Type = SPELL_TYPE_HEALHP Then

SendActionMsg Player(index).Map, "+" & Spell(.Spell).Vital, BrightGreen, ACTIONMSG_SCROLL, Player(index).x * 32, Player(index).y * 32

SetPlayerVital index, Vitals.HP, GetPlayerVital(index, Vitals.HP) + Spell(.Spell).Vital

DoEvents

SendVital index, HP

Else

SendActionMsg Player(index).Map, "+" & Spell(.Spell).Vital, BrightBlue, ACTIONMSG_SCROLL, Player(index).x * 32, Player(index).y * 32

SetPlayerVital index, Vitals.MP, GetPlayerVital(index, Vitals.MP) + Spell(.Spell).Vital

DoEvents

SendVital index, HP

End If

```

See, all I'm doing is adding a call to update the player with his/her new health. The DoEvents is just to make sure things don't get crunched together or accidentally missed.. May be useless. I like it so screw you ![:)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/smile.png) Hope this helps someone.
Link to comment
Share on other sites

Not quite but close. Kudos sir, thank you for putting that out there. That code does not include what is in SpellPlayer_Effect sub which is needed to display the initial impact of the spell. What it has that mine doesn't is the NPC portion. As a side-note, the version of eclipse that is available to download now already has your refrenced code in it except it **still** doesn't include the SendVital part. I don't understand why but that's how it is.
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...