Hit Start: How to Launch Your First Verse Countdown
Tutorial beginner

Hit Start: How to Launch Your First Verse Countdown

Updated beginner

Hit Start: How to Launch Your First Verse Countdown

You’ve built the map. You’ve placed the loot. But right now, it’s just a silent sandbox waiting for someone to walk into it. That’s boring. In Fortnite, nothing happens until the Battle Bus door opens. In Verse, nothing happens until you tell the code to start ticking.

In this tutorial, we’re going to build the "Start Button" for your island. We’ll create a countdown timer that appears on screen the moment a player joins, giving them a dramatic "3... 2... 1..." before the chaos begins. No abstract math, no confusing loops yet—just the essential mechanic of getting your game off the ground.

What You'll Learn

  • The OnBegin Event: How to make your code run automatically when a player spawns (like the bus dropping you onto the island).
  • The CountdownTimer Device: How to instantiate (create) a timer that talks to the player’s screen.
  • StartCountdown(): The single command that flips the switch from "waiting" to "go."

How It Works

Think of your Verse script like a director on a movie set. Before the actors (players) start acting, the director needs to yell "Action!" In UEFN (Unreal Editor for Fortnite), that yell is the OnBegin function.

Here is the flow we are building:

  1. The Setup: You define a variable to hold your timer. This is like buying a stopwatch before the race. It sits in your pocket, unused, until you need it.
  2. The Trigger: When a player spawns, OnBegin fires. This is the equivalent of the storm closing in—the game state is changing, and now is the time to act.
  3. The Creation: Inside OnBegin, we use a special function called MakeCountdownTimer. This creates a new instance of a timer, ties it to the specific player who just spawned, and sets the duration (e.g., 10 seconds).
  4. The Launch: Finally, we call .StartCountdown(). This is the moment the stopwatch starts ticking. The UI appears on the player's screen, and the game loop can begin.

If you skip step 4, you have a stopwatch that sits on the table. The players will stare at a blank screen, wondering why the game hasn't started. We aren't here for confusion; we're here for action.

Let's Build It

We are going to create a simple CreativeDevice that handles the start of the game. This script will wait for a player, grab their UI, and start a 10-second countdown.

Copy this code into your Verse file (e.g., start_game.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.
        Players := GetPlayspace().GetPlayers()
        if (ValidPlayer := Players[0]):
            
            # If we found a player, let's start the show!
            # Tell the timer to start ticking for this player.
            # This is the moment the UI pops up on the player's screen.
            MyTimer.Start(ValidPlayer)
            
            # Optional: Print a message to the debug log so you know it worked.
            Logger.Print("Countdown has started! Good luck, soldier.")
            
        else:
            # If no player is found, log an error.
            # This shouldn't happen in normal gameplay, but it's good to know if something is broken.
            Logger.Print("Error: No player found to start the countdown!", ?Level := log_level.Error)```

### Walkthrough: What Just Happened?

1.  **`using { ... }`**: These are your imports. Think of them as loading the correct DLCs. You need `Simulation` for basic game logic and `Devices` to talk to Fortnite-specific tools like timers.
2.  **`start_game_device`**: This is your class. Its the blueprint for your custom device. Youll place this device in your level, and this code will run.
3.  **`OnBegin<override>()<suspends>`**: This is the heart of the tutorial. `OnBegin` is an **event**a signal that says "Hey, the game is starting!" The `<suspends>` keyword is crucial. It tells Verse, "Hey, this code might need to wait a second for a player to show up, don't crash, just pause and keep trying."
4.  **`MakeCountdownTimer`**: This is a **constructor** (a factory function). It doesn't just create a timer; it creates a timer *for a specific player*. This is why we pass `ValidPlayer` into it. Without a player, the timer has no one to show the countdown to.
5.  **`StartCountdown()`**: This is the method call that actually begins the process. It’s the equivalent of pressing the "Start" button on a controller.

## Try It Yourself

You’ve got the basic countdown working. Now, let’s add some pressure.

**Challenge:** Modify the code above so that the countdown doesn't just stop at zero. Instead, when the countdown hits zero, it should print a message to the player saying "TIME'S UP!" and then stop.

*Hint: Look into the `CountdownTimer` device's events. Specifically, look for an event that triggers when the time reaches zero. Youll need to connect a function to that event inside your `OnBegin` block.*

## Recap

Starting a countdown in Verse is all about timing and context. You define a timer, wait for the `OnBegin` event (the player spawn), create the timer instance tied to that player, and then call `StartCountdown()`. Its the digital equivalent of the Battle Bus door openingonce you do it, theres no going back.

## References

- https://dev.epicgames.com/documentation/en-us/fortnite/making-a-custom-countdown-timer-using-verse
- https://dev.epicgames.com/documentation/en-us/fortnite/pizza-pursuit-3-creating-the-game-loop-for-time-trial-in-verse
- https://dev.epicgames.com/documentation/en-us/uefn/verse-prop-hunt-template-3-playing-effects-on-idle-players-in-unreal-editor-for-fortnite
- https://dev.epicgames.com/documentation/en-us/fortnite/pizza-pursuit-4-managing-and-displaying-the-score-for-time-trial-in-verse
- https://dev.epicgames.com/documentation/en-us/uefn/pizza-pursuit-3-creating-the-game-loop-in-verse

Verse source files

Turn this into a guided course

Add Starting the Countdown to your free study plan — we'll suggest related pages and stitch the lot into one compile-checked, self-guided lesson with worked examples and quizzes.

Original tutorial generated by Verse Island from the Verse/UEFN knowledge base, with references to the Epic Games sources above. Code is validated against the knowledge base.

Comments

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