Verse Library verse

01 Device

Waits for a trigger device activation, then prints a confirmation message to the console.

verse-library/niagara-quickstart/01-device.verse

# This is a simple Verse script
# It does not create the effect.
# It just shows how to use a trigger.

using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }

# We define a device called "MagicTrigger"
# This device is like a button on the floor.
MagicTrigger := class(creative_device):

    # TriggerDevice is a trigger_device placed in the level.
    # Wire this in the UEFN editor to a Trigger Device on your island.
    @editable
    TriggerDevice : trigger_device = trigger_device{}

    # OnBegin runs automatically when the game starts.
    OnBegin<override>()<suspends> : void =
        # Wait until a player activates the trigger, then print a message.
        # trigger_device.TriggeredEvent fires each time the trigger is activated.
        loop:
            Agent := TriggerDevice.TriggeredEvent.Await()
            Print("The magic is happening!")

Comments

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