Verse Library verse

02 Device

Activates a custom light when a player enters a designated trigger zone.

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

# StealthAlarm.verse

using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /Verse.org/Simulation/Tags }
using { /UnrealEngine.com/Temporary/Diagnostics }

# Define the script that will run as a creative_device placed in the level.
# In UEFN you add a "Verse Device" actor to the level and assign this class to it.
StealthAlarmScript := class(creative_device):

    # This variable holds the reference to the Customizable Light device.
    # Drag your 'StealthAlarmLight' actor onto this slot in the UEFN Details panel.
    @editable
    alarm_light : customizable_light_device = customizable_light_device{}

    # This variable holds the reference to the Trigger Zone device.
    # Drag your 'StealthTrigger' actor onto this slot in the UEFN Details panel.
    @editable
    alarm_trigger : trigger_device = trigger_device{}

    # This function runs when the game starts.
    OnBegin<override>()<suspends> : void =
        # Connect the trigger's TriggeredEvent to our reaction function.
        # Whenever an agent (player) activates this trigger, run 'OnPlayerEntered'.
        alarm_trigger.TriggeredEvent.Subscribe(OnPlayerEntered)

    # This function runs when the event fires.
    OnPlayerEntered(Agent : agent) : void =
        # Turn the light on.

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