how does the damaged event works

I was developing code for a gulag type class, if you were of the gulag class you, and along with the player that killed you would be teleported to a different arena where the winner of that arena would be able to go back to the fight(this gulag class/system is popularly used in warzone). I was able to make this code work but I had 1 issue. For some reason the code would only work if the final weapon used to kill was a shotgun (only tested 2 weapons), but wouldn’t work if it was an assault rifle. I can provide you with further information about the code structure, please let me know if you can help as I am new to Verse, wondering if this is a issue with the damaged event class as i also had a few problem with the same class when making a freeze player gun but this time it would only work after the first shot, ie the first shot would not freeze the enemy.

`code:
using { /Fortnite.com/Devices }
using { /Fortnite.com/Characters }
using { /Verse.org/Simulation }
using { /Verse.org/Random }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /UnrealEngine.com/Temporary/SpatialMath }
using { /Fortnite.com/Game}

gulag := class(creative_device):
var PlayersMap:[agent]CustomPlayer = map{}
var GlobalUserUniqueID: int = 1
var tpcheck : int = 1
@editable
DownButNotOut :down_but_not_out_device = down_but_not_out_device{}

Once(Him:agent) : void = 
    
    if:
        tpcheck = 1
    
    
    then:
        set tpcheck = 2
        Print("sssssssss22")
        Teleporter.Teleport(Him)
        Play.Register(Him)
        DownButNotOut.Disable()
        

        
Ouch(DamageResult2 : damage_result): void =
    Instigator := DamageResult2.Instigator
   

OnPlayerDamaged(DamageResult : damage_result): void =
    if:
        Instigator := DamageResult.Instigator?
        Agent := Instigator.GetInstigatorAgent[]
        tpcheck = 2
    then:
        Play2.Register(Agent)
        Sus.Teleport(Agent)
        set tpcheck = 1 


HimWins(Him:agent) : void = 
    Teleporter3.Teleport(Him)
    Play.Clear()

AgentWins(Agent: agent) : void = 
    Teleporter3.Teleport(Agent)
    Play2.Clear() 

@editable 
    Play: player_reference_device = player_reference_device{}
    @editable 
    Play2: player_reference_device = player_reference_device{}


@editable
Teleporter: teleporter_device = teleporter_device{}

@editable
Teleporter3: teleporter_device = teleporter_device{}

@editable
 Sus : teleporter_device = teleporter_device{}


# Runs when the device is started in a running game
OnBegin<override>()<suspends>:void=
    DownButNotOut.AgentDownedEvent.Subscribe(Once)
    Play.TrackedStatChangedEvent.Subscribe(HimWins)
    Play2.TrackedStatChangedEvent.Subscribe(AgentWins)
    for(Player : GetPlayspace().GetPlayers(), FortCharacter := Player.GetFortCharacter[]):
        FortCharacter.DamagedEvent().Subscribe(OnPlayerDamaged)

`

let me help you, send me the Custom Player you used

1 Like

got it to work thanks for the response tho