Verse Library verse

09 Starting The Countdown

Initializes a countdown timer linked to a player UI and game end device when the creative device begins.

extracted-snippets/documentation/en-us/fortnite/making-a-custom-countdown-timer-using-verse/09-starting-the-countdown.verse

# Source URL: https://dev.epicgames.com/documentation/en-us/fortnite/making-a-custom-countdown-timer-using-verse
# Local doc:  epic-docs/documentation/en-us/fortnite/making-a-custom-countdown-timer-using-verse.md
# Section:    Starting the Countdown
using { /Verse.org/Simulation }
using { /Fortnite.com/Devices }
countdown_timer_example := class(creative_device):
@editable
AddMoreTimeButton : button_device = button_device{}
@editable
EndGame : end_game_device = end_game_device{}
var CountdownTimer : countdown_timer = countdown_timer{}
InitialCountdownTime : float = 30.0
OnBegin<override>()<suspends> : void =
if:
FirstPlayer := Self.GetPlayspace().GetPlayers()[0]
PlayerUI := GetPlayerUI[player[FirstPlayer]]
then:
set CountdownTimer = countdown_timer{MaybePlayerUI := option{PlayerUI}, RemainingTime := InitialCountdownTime}
CountdownTimer.StartCountdown()
else:
Print("Can't find player")

Comments

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