using { /Fortnite.com/Devices } using { /Fortnite.com/Characters } using { /Verse.org/Simulation } using { /UnrealEngine.com/Temporary/Diagnostics } # revenge_trap_manager is a Verse device you place in your UEFN level. # Wire TrapButton, TrapDoor, and LootSpawner to these properties # in the UEFN editor Details panel. revenge_trap_manager := class(creative_device): # TrapButton: a button_device placed in the level. # Wire it here via the UEFN editor. @editable TrapButton : button_device = button_device{} # TrapDoor: a conditional_button_device used as a gate/door lock. # Wire your door-controlling device here. # note: Verse has no dedicated "door_device"; use a conditional_button_device # or a gate_device to enable/disable passage. @editable TrapDoor : conditional_button_device = conditional_button_device{} # LootSpawner: an item_spawner_device that drops loot when activated. @editable LootSpawner : item_spawner_device = item_spawner_device{} # OnBegin is called automatically when the game session starts. OnBegin() : void = # Subscribe to the button's InteractedWithEvent. # This event fires whenever any player presses TrapButton. # The event passes the agent (player) who pressed it as the instigator. TrapButton.InteractedWithEvent.Subscribe(OnTrapButtonPressed) # OnTrapButtonPressed runs every time a player presses TrapButton. # Agent is the instigator — the player who pressed the button. OnTrapButtonPressed(Agent : agent) : void = # 1. Check if the agent is a fort_character so we can act on them. if (Player := player[Agent]): # 2. Lock the door by disabling the conditional_button_device. # Disabling it prevents further interaction, simulating a lock. TrapDoor.Disable() # 3. Spawn loot at the item_spawner_device. LootSpawner.SpawnItem() # 4. Print a debug message so we can verify the trap fired. # note: player has no SendMessage API in public Verse; use Print for debugging. Print("Trap triggered! Door locked and loot spawned.")