Verse Library verse

01 Device

Wires a trigger to activate a spawner and create a UFO vehicle when players start the race.

verse-library/using-ufo-spawner-devices-in-fortnite-creative/01-device.verse

# This is our main script.
# It connects the trigger to the spawner.

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

# We create a "Device Table".
# Think of this as a list of devices we control.
# We give them simple names.
ufo_race_manager := class(creative_device):

    # The trigger that starts the game
    @editable
    StartTrigger : trigger_device = trigger_device{}

    # The spawner that creates the UFO
    # note: ufo_spawner_device is the real Verse type for the UFO Spawner device.
    @editable
    UfoSpawner : ufo_spawner_device = ufo_spawner_device{}

    # OnBegin runs automatically when the game starts.
    # This is where we wire up our event listeners.
    OnBegin<override>()<suspends> : void =

        # This is an "Event".
        # An event is a signal. It says "Hey! Something happened!"
        # Here, we listen for when the trigger is pressed.
        StartTrigger.TriggeredEvent.Subscribe(OnStartTriggered)

    # This function runs when the trigger fires.

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