Verse Library verse

01 Device

Monitors a floor trigger device and activates a light fixture when a player steps on it.

verse-library/note-trigger-api/01-device.verse

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

# This is our brain. It controls the trap.
# We name it 'MusicalLightTrap'.
MusicalLightTrap := class(creative_device):

    # This is the Note Trigger device.
    # It waits for a player to step on it.
    @editable
    NoteTrigger : note_trigger_device = note_trigger_device{}

    # This is the light we want to turn on.
    @editable
    MyLight : customizable_light_device = customizable_light_device{}

    # This runs when the game starts.
    OnBegin<override>()<suspends> : void =
        # Print a message to check if it works.
        Print("The trap is ready!")

        # Wait for the trigger signal.
        # This line waits forever until the note triggers.
        # note: TriggeredEvent fires when the note_trigger_device activates.
        NoteTrigger.TriggeredEvent.Await()

        # Once triggered, turn on the light!
        MyLight.TurnOn()

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