# This is a Verse script that listens for a button press # and triggers a prop-mover to launch a player. # 1. IMPORTS # We need to import the 'Devices' library to access Button, # Prop-Mover, and their built-in events. using { /Fortnite.com/Devices } using { /Verse.org/Simulation } # 2. THE SCRIPT STRUCTURE # This is the container for our logic. # Think of it as the "Island" itself, but for this specific mechanic. # In UEFN, you attach this creative_device to your Button device # in the level, and wire the PropMover reference in the editor. LaunchPadScript := class(creative_device): # 3. DECLARING OUR DEVICES # We need references to the actual devices in our level. # In the UEFN editor, drag your Prop-Mover device into the # 'PropMover' field that appears on this script component. @editable PropMover : prop_mover_device = prop_mover_device{} @editable RevengeButton : button_device = button_device{} # 4. OnBegin — the entry point # OnBegin runs automatically when the game session starts. # This is where we subscribe to events so our code starts listening. OnBegin() : void = # 5. SUBSCRIBING TO THE EVENT # 'InteractedWithEvent' fires whenever a player presses # this button. We pass our handler function to Subscribe # so Verse knows what code to run when it fires. # This is the code equivalent of drawing a wire in the editor. RevengeButton.InteractedWithEvent.Subscribe(HandleButtonPress) # 6. THE FUNCTION # This function runs ONLY when the event above fires. # It takes a 'player' as input (the person who pressed the button). HandleButtonPress(Agent : agent) : void = # 7. TRIGGERING THE DEVICE # We call Begin() on our Prop-Mover. # This is the function that does the work — springing the trap! PropMover.Begin()