using { /Fortnite.com/Devices } using { /Fortnite.com/Characters } using { /Fortnite.com/Game } using { /Verse.org/Simulation } using { /UnrealEngine.com/Temporary/Diagnostics } # 1. Define our Trap Device revenge_trap_device := class(creative_device): # This is the 'Target' zone. When a player enters, this triggers. # Wire this in UEFN to a Trigger device placed in your level. @editable TriggerDevice : trigger_device = trigger_device{} # 2. The Core Logic: Overlap via trigger_device # This function runs when an agent activates the TriggerDevice OnTriggered(Agent : ?agent) : void = # Check if the 'Agent' is a fort_character (i.e. has a game character) if (ActualAgent := Agent?, FortCharacter := ActualAgent.GetFortCharacter[]): # HERE IS THE KEY PART: # 'Agent' IS the Source of the overlap. # We don't need to look it up; it's right there! # Let's do something with the Source (the player character) # Eliminate them via damage — fort_character exposes Damage() FortCharacter.Damage(9999.0) # Optional: Print to console to prove we know who the Source is # In a real game, you'd probably send a message to the player's chat Print("Revenge Trap activated! Source was an agent.") # 3. Initialization OnBegin() : void = # Connect the trigger's TriggeredEvent to our handler function. # This tells Verse: "When TriggerDevice fires, run OnTriggered" TriggerDevice.TriggeredEvent.Subscribe(OnTriggered)