Verse Library verse

01 Fragment

Toggles a video playback device on or off when a switch is activated.

verse-library/using-video-player-devices-in-fortnite-creative/01-fragment.verse

# Import the necessary modules
# Think of these as the "Loadout" for our script.
# We need the core Verse library and the Video Player device definitions.
use core:/engine/core.verse
use video_player:/engine/video_player.verse

# Define our Script
# This is the "Player Spawner" for our logic.
# It binds our code to the devices we place in the editor.
script MusicVideoClub <|
    # The Switch Device
    # This is like the "Trigger" in a trap.
    # It waits for a signal.
    switch_device: SwitchDevice = SwitchDevice{}

    # The Video Player Device
    # This is the "Prop Mover" but for media.
    # It holds the video stream.
    video_player: VideoPlayerDevice = VideoPlayerDevice{}

    # The "On Switch Flipped" Event
    # This is the "Elimination Event" for our logic.
    # It fires when the switch is activated.
    on_switch_flipped() =|
        # Check if the video is currently playing
        # If it is, stop it. If not, play it.
        # This is like checking if the Storm is active before turning it on.
        if video_player:is_playing() =|
            # Stop the video
            video_player:stop()

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