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

HandleHot_ Sillyness.


Zappy
 Share

Recommended Posts

Hey y'all. I've seem to have run into a snag which I don't quite understand. I've been tinkering with spells, making them all stat based, including dots and hots. Now, dots work absolutely perfectly, and hots ALMOST work. except for one little problem.

```
Public Sub HandleHoT_Player(ByVal index As Long, ByVal hotNum As Long)
                        Dim SkillLevel As Long
                        Dim Vital As Long
                        Dim HOT As Long
    With TempPlayer(index).HOT(hotNum)
        If .Used And .Spell > 0 Then
            ' time to tick?
            If GetTickCount > .Timer + (Spell(.Spell).Interval * 250) Then

                    SkillLevel = Player(.Caster).Stat(Intelligence)
                    Vital = Spell(.Spell).Vital
                    HOT = (((Round(Vital + Random((Vital / 2), (Vital * 2) / 2)) + Round(SkillLevel * Random((SkillLevel / 2), (SkillLevel * 5) / 10)))) * 0.2)

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

                Player(index).Vital(Vitals.HP) = (Player(index).Vital(Vitals.HP) + HOT)
                Call SendVital(index, Vitals.HP)

                .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

```
I've sifted through the errors, and commented out individual lines to come to the conclusion that this line:
```
SkillLevel = Player(.Caster).Stat(Intelligence)
```
is the problem.

Dot used the exact same line, and works just fine. In hot however, I'm given "subscript out of range".
I've changed it to
```
SkillLevel = 10
```and it works, so I clearly can't grab the player stat this way in this specific sub…
My question is, how WOULD I go about grabbing the stat, if I can't do it this way?
Thanks <3
Link to comment
Share on other sites

This code would get the intelligence of the player the HoT is casted ON:
```
SkillLevel = GetPlayerStat(index, Stats.Intelligence)

```
The old code you used works in DoT because the TempPlayer(index).Dot.Caster Type has actually been set (so the server can say who killed who).

Also, instead of:
```
Player(index).Vital(Vitals.HP) = (Player(index).Vital(Vitals.HP) + HOT)

```
do:
```
SetPlayerVital index, Vitals.HP, GetPlayerVital(index, Vitals.HP) + HOT

```
(Which is unrelated to your problem, but it does make sure the player won't gain health over the limit.)

EDIT: made some changes to clarify the code
Link to comment
Share on other sites

Ah thanks, I was using SetPlayerVital for little bit, but wasn't sure I wanted to tamper with anything until I fixed the issue. x)

I'll go look into all the subs and functions called in Dot to figure it out, thanks ^-^
Link to comment
Share on other sites

@L:

> Ah thanks, I was using SetPlayerVital for little bit, but wasn't sure I wanted to tamper with anything until I fixed the issue. x)
>
> I'll go look into all the subs and functions called in Dot to figure it out, thanks ^-^

Advice: check out AddHot_ and compare it to AddDot_ and compare their parameters, add the one you want (hint: Caster) to AddHot_. Then search for where AddHot_ is called and add this new parameter to the call.

I also moved this topic to Source Questions.
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...