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 := class(creative_device): # @editable means you can change this number in the UEFN panel. # It's the "Initial Health" of your game. @editable InitialTime : 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 tag means this function can pause and wait for things (like players) to happen. OnBegin() : 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)