Verse Library verse

01 Device

Wires a trigger device to stream and load specific level instances into the game world.

verse-library/using-level-instance-devices-in-fortnite-creative/01-device.verse

# This is a simple Verse script for a Level Loader.
# It loads a Level Instance when a player walks on a trigger.

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

# We define our Level Loader device.
# This is the "magic elevator" we talked about.
my_device := class(creative_device):

    # Drag your Level Loader device into this property slot in UEFN.
    @editable
    LevelLoader : level_loader_device = level_loader_device{}

    # Drag your Trigger device into this property slot in UEFN.
    @editable
    Trigger : trigger_device = trigger_device{}

    # This function runs when the game begins.
    OnBegin<override>()<suspends> : void =
        # Wait for a player to walk on the mat.
        Agent := Trigger.TriggeredEvent.Await()

        # Load the saved Level Instance.
        # The Level Loader places the tower here.
        # note: level_loader_device exposes LoadLevel() to start streaming the level in.
        LevelLoader.LoadLevel()

        # Print a message to the console.
        Print("Tower loaded!")

Comments

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