Confused by OnPlayerEliminated Event

New to verse, and doing the first project (gun game) in the documentation. However, this code is not making sense to me -

OnPlayerEliminated(Result:elimination_result):void=
    Print("Player Eliminated")
    EliminatingCharacter := Result.EliminatingCharacter
    if (FortCharacter := EliminatingCharacter?, EliminationAgent := FortCharacter.GetAgent[]):
        GrantNextWeapon(EliminationAgent)
        Print("Player Promoted")

So when testing this on sentries it works fine, and I assume it works fine with players, however if a player dies in the environment (fall damage, lava, etc), they get promoted and both print statements print and I don’t understand why. Can someone please guide me on this. thanks!

You need to compare Result.EliminatedCharacter.GetAgent[] with EliminationAgent to avoid Self Eliminations :+1:

Also, you can take a look at this script, which is basically the gungame gamemode

lol should read previous posts b4 i reply :stuck_out_tongue:

tha anwser above is the way

Here’s the updated code in-case anyone else is following the documentation:

    OnPlayerEliminated(Result:elimination_result):void=
        Print("Player Eliminated")
        #EliminatingCharacter := Result.EliminatingCharacter 
        Eliminator := Result.EliminatingCharacter
        Eliminated := Result.EliminatedCharacter
        if (FortCharacter := Eliminator?, EliminatingAgent := FortCharacter.GetAgent[]): 
            if (Eliminated.GetAgent[] <> EliminatingAgent):
                GrantNextWeapon(EliminatingAgent)
                Print("PVP")
            else:
                Print("PVE")