Verse Library verse

01 Fragment

Links a timer expiration event to an end game device to auto-terminate the match.

verse-library/the-timer-device-used-to-end-the-game-after-a-certain-amount-of-time/01-fragment.verse

# This script attaches to the End Game device.
# It tells the End Game device: "Listen to the Timer. When it finishes, YOU stop the game."

using { /Fortnite.com/Devices }

end_game_device: EndGameDevice = EndGameDevice{}

# This is the "Event Handler."
# Think of it as a trap trigger. 
# We are listening for the timer's "OnTimerEnd" event.
on_timer_finished(timer: TimerDevice) -> unit:
    # When the timer hits zero, this code runs.
    # We call the EndGame() function on our End Game device.
    end_game_device.EndGame()

# This is the "Setup" function.
# It runs once when the island starts.
init() -> unit:
    # 1. Find the Timer device in the scene graph.
    # We assume we have a reference to the Timer. 
    # In a real setup, you might link this in the editor or via a variable.
    # For this example, let's assume we have a Timer variable named 'my_timer'.
    my_timer: TimerDevice = TimerDevice{} 
    
    # 2. Configure the Timer.
    # Set the duration to 60 seconds.
    my_timer.SetDuration(60.0)
    
    # Start the timer immediately when the game starts.
    my_timer.Start()

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