Verse Library verse

01 Device

Wires a player trigger to reveal LEGO assembly devices upon activation.

verse-library/using-lego-assembly-devices-in-fortnite-creative/01-device.verse

# This is the main script for our LEGO tower
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }

# We define the devices we will use
lego_tower_manager := class(creative_device):

    # The assembly device controls the tower
    @editable
    assembly_device : creative_device = creative_device{}
    # The trigger detects the player
    @editable
    trigger : trigger_device = trigger_device{}

    # This function runs when the game starts
    OnBegin<override>()<suspends> : void =
        # Connect the trigger to our code
        # When the trigger fires, run 'OnTriggered'
        trigger.TriggeredEvent.Subscribe(OnTriggered)

    # This function runs when a player steps on the pad
    OnTriggered(Agent : ?agent) : void =
        # Make the LEGO tower appear
        # We set it to visible
        assembly_device.Show()

        # You can also play a sound here if you want!

Comments

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