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

[Bug Fix] Heal MP in Time Spells (Buff)


Valentine90
 Share

Recommended Posts

**Sorry my english**

The Soul created a tutorial for the same purpose, but was not complete, so I completed.

**Soul:**

It seems that the code for HoTs just assumes you want to heal HP. So even setting a Heal MP spell will heal the HP, regardless of the type of magic. Points are not affected by this error. Here is a fix (not elegant, but I tried to touch existing code as little as possible):

**Valentine:**

Besides the bug mentioned above, there is another, when the player is healed is not sent to the client the new HP or MP, then added a code to fix this.

**Open Server**

**Fix for players**

**1 -** Search for:

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

Player(index).Vital(Vitals.HP) = Player(index).Vital(Vitals.HP) + Spell(.Spell).Vital
```

**2 -** Replace it:

```
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

Call SendVital(Index, Vitals.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

Call SendVital(Index, Vitals.MP)

End If
```

**Fix for NPCs**

**1 -** Search for:

```
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
```

**2 -** Replace it:

```
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

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

End If
```

**Credits:**

Soul

Valentine
Link to comment
Share on other sites

  • 3 weeks later...
i dont have in eo 2.3

```

Player(index).Vital(Vitals.HP) = Player(index).Vital(Vitals.HP) + Spell(.Spell).Vital

```

i have

```

Public Sub HandleHoT_Player(ByVal Index As Long, ByVal hotNum As Long)

With TempPlayer(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 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

.Timer = GetTickCount

' check if DoT is still active - if player 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 With

End Sub

```
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...