# This is a Verse script for a Revenge Trap. # It launches a player when they step on a pressure plate. # 1. Define the Function: "LaunchPlayer" # Think of this as defining the "Launch" loadout slot. # It takes no inputs (empty parentheses) and returns nothing (void). LaunchPlayer := function () { # Find the Prop Mover device by its name in the world. # If it doesn't exist, this will fail, so make sure you named it correctly! pad := World.FindDeviceByName ("LaunchPad") # Check if the device actually exists. # This is like checking if your gun has ammo before shooting. if (pad != nil) { # "Activate" the Prop Mover. # This tells the device to start moving its target. pad.Activate () # Optional: Wait 2 seconds, then reset it. # This is like the cooldown on a special ability. World.SetTimer (2.0, func () { pad.Deactivate () }) } } # 2. Define the Event: "OnPlayerBeginOverlap" # This is the referee listening for a rule break. # It listens for any player stepping on the Pressure Plate. OnPlayerBeginOverlap := function (event : Event < (Player : Player) >) { # When a player steps on the plate, call the LaunchPlayer function. # This is like blowing the whistle and making the referee act. LaunchPlayer () } # 3. Connect the Event to the Device # We need to tell the Pressure Plate to listen for overlaps. # In UEFN, you usually do this in the device's properties, # but in Verse, we can attach the event handler to the world. # Note: For simplicity in this beginner tutorial, # we assume the Pressure Plate is set to trigger "OnBeginOverlap" # in its own properties, and we hook into that global event. # To make this work, we need to register the event handler. # This is like telling the referee, "Watch this specific player." World.OnPlayerBeginOverlap += OnPlayerBeginOverlap