Verse Library verse

01 Fragment

Counts down seconds using scheduled functions and triggers a round end event when time expires.

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

# This is a comment. It's like leaving a sticky note for yourself.
# The compiler (the game's code checker) ignores these.

# 1. DEFINE THE STRUCTURE
# Think of this as the "Blueprint" for our Timer System.
# It holds all the parts we need.
struct MySurvivalTimer:
    # This is our Variable. It's a "Container" for the time.
    # We start it at 60 seconds.
    TimeRemaining: int = 60
    
    # This is a reference to the Storm Device.
    # We'll connect this in the editor later.
    StormDevice: StormDevice
    
    # This is a reference to the End Game Device.
    # We'll use this to trigger the win/loss state.
    EndGameDevice: EndGameDevice

# 2. DEFINE THE FUNCTIONS (The Actions)
# This function is like a "Stopwatch Tick."
# It runs every second.
func Tick() -> void:
    # Check if we still have time
    if TimeRemaining > 0:
        # Subtract 1 from our Variable (the Loot Box)
        TimeRemaining = TimeRemaining - 1
        
        # Optional: Print to the debug console so we know it's working
        print("Time Left: ", TimeRemaining)

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