# This script makes a Volume device react to players using { /Fortnite.com/Devices } using { /Verse.org/Simulation } using { /UnrealEngine.com/Temporary/Diagnostics } # 1. Define the device class. Think of this as declaring "I am a Trap Master." # We inherit from creative_device, which is the real base class for # all placeable Verse devices in UEFN. sky_trap_device := class(creative_device): # 2. This is the "Scene Graph" connection. # 'LaunchProp' is a variable that holds a reference to another device in the level. # We will link this in the editor later. # @editable exposes the variable in the Details panel so you can drag-and-drop # a Prop Mover into it from the World Outliner. @editable LaunchProp : prop_mover_device = prop_mover_device{} # 3. The "OnBegin" function runs once when the game starts. # This is like the "Start" button on the Battle Bus. OnBegin() : void = # Subscribe to the Volume's AgentEntersEvent on the mutator_zone_device. # MutatorZone is the real UEFN device that acts as an invisible trigger volume. # We wait for any agent (player) to enter, then call our handler. # Note: mutator_zone_device is the closest real API to a "Volume" sensor device; # it fires AgentEntersEvent when a player walks into its bounds. Print("Sky Trap is armed and waiting...") # 4. Bind the PlayerEntered event. # AgentEntersEvent fires whenever an agent enters the mutator zone. # We subscribe to it and call OnPlayerEntered each time it triggers. MutatorZone.AgentEntersEvent.Subscribe(OnPlayerEntered) # 5. The "OnPlayerEntered" handler. # This function is called automatically when a player steps in. # It's like a doorbell ringing. # 'Agent' is the real parameter type — the entity that entered the zone. OnPlayerEntered(Agent : agent) : void = # When the player enters, tell the Prop Mover to activate. # Activate() is the real method on prop_mover_device that starts its movement. LaunchProp.Activate(Agent) # Optional: Print a message so you can confirm the trap fired during testing. Print("Trap triggered! Player launched!") # Reference to the mutator_zone_device placed in the level. # @editable lets you assign it in the Details panel. # Note: mutator_zone_device is the real UEFN "volume sensor" device; # configure it in the editor to set its size and shape over your floor tile. @editable MutatorZone : mutator_zone_device = mutator_zone_device{}