Verse Library verse

01 Device

Tutorial script triggering a light alarm when players enter a zone.

verse-library/configure-the-alarm-system/01-device.verse

# 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<override>()<suspends> : 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.

Sign in free to read the full source 🌴

This Verse Library file is members-only. Create a free account to view the complete source and download the .verse file.

Sign in with Discord

Comments

    Sign in to vote, comment, or suggest an edit. Sign in