Verse Library verse

01 Device

Plays a cinematic sequence when the game starts or a trigger is activated.

verse-library/playing-sequences-in-game/01-device.verse

# This is our main script file.
# It will run when the game starts.

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

# We create a new kind of device.
# This device knows how to play our movie.
welcome_sequence_controller := class(creative_device):

    # This is the device that holds the movie.
    # We link it in the editor.
    @editable
    Cinematic_Device : cinematic_sequence_device = cinematic_sequence_device{}

    # When the game starts, this function runs automatically.
    # It waits for a signal, then calls Start_Show().
    # This part connects the button press to the movie.
    OnBegin<override>()<suspends> : void =
        # We wait for the sequence device's PlaybackStarted event as an example hook.
        # In your project, replace this with your trigger's Triggered event.
        # e.g.  MyTrigger.TriggeredEvent.Await()
        Start_Show()

    # This is the function that starts the show.
    # It takes no input and returns nothing.
    Start_Show() : void =
        # This line plays the sequence!
        # It tells the device to run the animation.
        Cinematic_Device.Play()

Comments

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