# RevengeTrap.verse # This script makes a trap remember who killed you and target them on start. using { /Fortnite.com/Devices } using { /Fortnite.com/Game } using { /Verse.org/Simulation } using { /UnrealEngine.com/Temporary/Diagnostics } revenge_trap := class(creative_device): # 1. Define the devices we need to interact with. # These are set via the Details panel in UEFN by dragging the devices in. @editable Trigger : trigger_device = trigger_device{} # The Prop Mover is the weapon we want to drop. # Wire this up in the UEFN Details panel by selecting your "Anvil" prop mover. @editable Anvil : prop_mover_device = prop_mover_device{} # 2. Create a Variable to store the killer's agent reference. # This is like a logbook entry. It starts empty (?agent holds an optional value). var KillerAgent : ?agent = false # 3. The "OnBegin" Event. # This function runs exactly once when the match starts. OnBegin() : void = # Get all players currently in the game via the fort_playspace. # GetPlayspace() returns the active playspace for this island. Playspace := GetPlayspace() AllPlayers := Playspace.GetPlayers() # Check if there are any players. if (AllPlayers.Length > 0): # Store the first player's agent reference in our variable. # AllPlayers[0] returns an ?agent (optional), so we unwrap it with 'if'. if (FirstPlayer := AllPlayers[0]): set KillerAgent = option{FirstPlayer} # Print a message to the debug log (Output Log in UEFN). # This confirms OnBegin ran successfully. Print("Match Started! Targeting a player.") # Arm the trap: tell the Anvil prop mover to activate. # Enable() makes the prop mover start its movement sequence. Anvil.Enable() Print("Anvil Armed! Waiting for target...") else: Print("No players found. Trap remains dormant.") # 4. A Helper Function to check if a specific agent matches our stored killer. IsTargetInZone(InAgent : agent) : logic = # Unwrap our optional KillerAgent and compare it to the incoming agent. if (Killer := KillerAgent?): return Killer = InAgent return false