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

[CS:DE] OnDeath


Synergy
 Share

Recommended Posts

Hi all,

Just looking at the CS:DE sub "OnDeath" in ModPlayer, Robin's annotation says 'ToDo:

```
' ToDo
Sub OnDeath(ByVal Index As Long)
    Dim I As Long

    ' Set HP to nothing
    Call SetPlayerVital(Index, Vitals.HP, 0)

    ' Drop all worn items
    For I = 1 To Equipment.Equipment_Count - 1
        If GetPlayerEquipment(Index, I) > 0 Then
            PlayerMapDropItem Index, GetPlayerEquipment(Index, I), 0
        End If
    Next

    ' Warp player away
    Call SetPlayerDir(Index, DIR_DOWN)

    With Map(GetPlayerMap(Index))
        ' to the bootmap if it is set
        If .BootMap > 0 Then
            PlayerWarp Index, .BootMap, .BootX, .BootY
        Else
            Call PlayerWarp(Index, START_MAP, START_X, START_Y)
        End If
    End With

    ' clear all DoTs and HoTs
    For I = 1 To MAX_DOTS
        With TempPlayer(Index).DoT(I)
            .Used = False
            .Spell = 0
            .Timer = 0
            .Caster = 0
            .StartTime = 0
        End With

        With TempPlayer(Index).HoT(I)
            .Used = False
            .Spell = 0
            .Timer = 0
            .Caster = 0
            .StartTime = 0
        End With
    Next

    ' Clear spell casting
    TempPlayer(Index).spellBuffer.Spell = 0
    TempPlayer(Index).spellBuffer.Timer = 0
    TempPlayer(Index).spellBuffer.target = 0
    TempPlayer(Index).spellBuffer.tType = 0
    Call SendClearSpellBuffer(Index)

    ' Restore vitals
    Call SetPlayerVital(Index, Vitals.HP, GetPlayerMaxVital(Index, Vitals.HP))
    Call SetPlayerVital(Index, Vitals.MP, GetPlayerMaxVital(Index, Vitals.MP))
    Call SendVital(Index, Vitals.HP)
    Call SendVital(Index, Vitals.MP)
    ' send vitals to party if in one
    If TempPlayer(Index).inParty > 0 Then SendPartyVitals TempPlayer(Index).inParty, Index

    ' If the player the attacker killed was a pk then take it away
    If GetPlayerPK(Index) = YES Then
        Call SetPlayerPK(Index, NO)
        Call SendPlayerData(Index)
    End If

End Sub

```
I'm a bit confused as to what the "ToDo" is for? What isn't completed here, because as far as I can see, it is done.. I think I'm being blind though..

Also, "Sub KillPlayer" has "Call OnDeath" at the end, so I'm right in saying that it is calling the OnDeath sub, and thus it is working?

I'm just curious, really.
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...