# This is a comment. The game ignores it. It's just for us. using { /Fortnite.com/Devices } using { /Verse.org/Simulation } using { /UnrealEngine.com/Temporary/Diagnostics } # 1. Define the Script # Think of this as the "Rulebook" for our alarm. # In real Verse, a device script is a class that extends creative_device. StealthAlarmScript := class(creative_device): # 2. Define the Variables (The Containers) # '@editable' lets you drag-and-drop the device reference in the UEFN editor. # 'alarm_light' will hold the reference to our Customizable Light device. # 'alarm_trigger' will hold the reference to our Trigger Zone. @editable alarm_light : customizable_light_device = customizable_light_device{} @editable alarm_trigger : trigger_device = trigger_device{} # 3. The 'OnBegin' Function # This runs once when the game starts. It's like the bus dropping players. OnBegin() : void = # 4. Connect the Devices # Because we used @editable above, alarm_light and alarm_trigger are # already set to the devices we picked in the editor — no searching needed. # 5. Listen for the Event # We want to know when someone enters the trigger zone. # trigger_device has an event called TriggeredEvent. # We connect that event to a function we'll create next. alarm_trigger.TriggeredEvent.Subscribe(OnPlayerEntered) # 6. The Reaction Function # This is what happens when the event fires. # trigger_device.TriggeredEvent passes the instigating agent (player) as ?agent. OnPlayerEntered(Agent : ?agent) : void = # 'Agent' is the player who stepped on the zone. # Turn the light ON. alarm_light.TurnOn() # Optional: Make it flash by enabling the light's built-in pulse. # The customizable_light_device does not expose a runtime SetRhythm API, # so configure the Rhythm Preset to "Wave" in the editor instead. # note: runtime rhythm/color APIs are not yet available in the public Verse SDK; # use the device's Customize panel in UEFN to pre-set color and rhythm.