Elimination Manager Sends Wrong Player

Reference ID

5c4e7b2e-4530-183a-66f0-aa905d9d16eb

Please select what you are reporting on:

Verse

What Type of Bug are you experiencing?

Devices

Summary

The “EliminationEvent” of elimination manager can send the wrong player when a player takes damage and then respawns. The elimination feed and scoreboard will credit the player that did damage with the elimination, but the “EliminationEvent” will send the eliminated player. This does not happen in edit sessions since respawning after taking damage in edit sessions seems to always count as a self-elimination.

Steps to Reproduce

Create a Verse device with an elimination manager device and a HUD message device that only shows to the triggering player. In the “OnBegin” of the Verse device, subscribe to “EliminationEvent” and “EliminatedEvent” of the elimination manager. In the Verse device, create a key-value map for the number of eliminations per player and number of times eliminated per player. Increment the eliminations value in the subscription of the “EliminationEvent” and the eliminated value in the subscription of the “EliminatedEvent”. Show the HUD message with a custom message containing the number of eliminations and times eliminated.

Player A and Player B spawn on opposite teams. Player B damages Player A. Player A eliminates Player B. Player A respawns.

Sample Code:

@editable
EliminationManager : elimination_manager_device = elimination_manager_device{}

@editable
HUDMessage : hud_message_device = hud_message_device{}

var EliminationsPerPlayer : [player]int = map{}
var EliminatedPerPlayer : [player]int = map{}

Message<localizes>(Eliminations : int, Eliminated : int) : message = "Eliminations: {Eliminations} | Eliminated: {Eliminated}"

OnBegin<override>()<suspends>:void=
    EliminationManager.EliminationEvent.Subscribe(OnElimination)
    EliminationManager.EliminatedEvent.Subscribe(OnEliminated)

OnElimination(MaybeAgent : ?agent):void=
    if (Agent := MaybeAgent?, Player := player[Agent]):
        Eliminations := (EliminationsPerPlayer[Player] or 0) + 1
        Eliminated := EliminatedPerPlayer[Player] or 0

        if (set EliminationsPerPlayer[Player] = Eliminations){}

        HUDMessage.Show(Player, Message(Eliminations, Eliminated))

OnEliminated(Agent : agent):void=
    if (Player := player[Agent]):
        Eliminations := EliminationsPerPlayer[Player] or 0
        Eliminated := (EliminatedPerPlayer[Player] or 0) + 1

        if (set EliminatedPerPlayer[Player] = Eliminated){}

        HUDMessage.Show(Player, Message(Eliminations, Eliminated))

Expected Result

Player A will see “Eliminations: 1 | Eliminated: 1” and Player B will see “Eliminations: 1 | Eliminated: 1”.

Observed Result

Player A sees “Eliminations: 2 | Eliminated: 1” and Player B sees “Eliminations: 0 | Eliminated: 1”.

Platform(s)

windows

UCB-1242 incident has been created. Status is ‘Awaiting Validation’.