Verse Library verse

01 Device

Initializes a director class to start a match countdown timer when players spawn.

verse-library/starting-the-countdown/01-device.verse

using { /Verse.org/Simulation }
using { /Verse.org/Native }
using { /Fortnite.com/Devices }
using { /Fortnite.com/Game }
using { /UnrealEngine.com/Temporary/Diagnostics }

# This is our "Director" class. It controls the start of the game.
# Think of it as the Game Coordinator who decides when the match begins.
start_game_device<public> := class(creative_device):

    # @editable means you can change this number in the UEFN panel.
    # It's the "Initial Health" of your game.
    @editable
    InitialTime<public> : float = 10.0

    # This is a reference to a timer_device placed on the island.
    # Wire it up in the UEFN panel.
    @editable
    MyTimer : timer_device = timer_device{}

    # The logger lets us print debug messages to the output log.
    Logger : log = log{}

    # OnBegin is the "Action!" command.
    # It runs automatically when the player spawns into the island.
    # The <suspends> tag means this function can pause and wait for things (like players) to happen.
    OnBegin<override>()<suspends> : void =
        # First, we need to find the player.
        # GetPlayspace().GetPlayers() returns all current players.
        # We grab the first one if available.

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