using { /Fortnite.com/Devices } using { /Fortnite.com/Characters } using { /Fortnite.com/Game } using { /Verse.org/Simulation } using { /UnrealEngine.com/Temporary/Diagnostics } using { /EpicGames.com/Temporary/UI } using { /Verse.org/Native } # This is our main class. Think of it as the "Brain" of our island. RoundHandicapManager := class(creative_device): # 1. DEVICE LINKS # These are the devices you drag into the editor. @editable StartTimer : timer_device = timer_device{} @editable HandicapLight : cinematic_sequence_device = cinematic_sequence_device{} # note: prop_mover has no SetVisibility method in the real API; we use # cinematic_sequence_device to drive a visibility sequence instead. # Alternatively, wire a customizable_light_device here and call Enable/Disable. # 2. DATA STORAGE (The "Nametag") # We create a weak map that links each Player to a 'logic' value (True/False). # false means they are a normal player. true means they are handicapped. var PlayerStatus : weak_map(player, logic) = map{} # 3. THE ROUND TIMER EVENT # This runs every time the timer finishes a countdown. OnStartTimerFinished(InAgent : agent) : void = # When the timer ends, we check who is in the game. Players := GetPlayspace().GetPlayers() for (Player : Players): # Get the player's display name and measure its length. Name := Player.GetDisplayName[] NameLength := Name.Length # SIMULATE ROUND LOGIC: # For this demo, if the player's name has an even number of letters, # they lose Round 1. (Just a fun, random way to pick a loser.) IsLoser : logic = if (Mod[NameLength, 2] = 0) then true else false # UPDATE THE MAP: # If they are a loser, set their status to true. Otherwise, false. if (IsLoser): set PlayerStatus[Player] = true else: set PlayerStatus[Player] = false # APPLY THE HANDICAP FOR NEXT ROUND: # We immediately toggle the cinematic sequence to show who "lost". if (PlayerStatus[Player]): # If True, play the sequence (e.g. sequence drives a red light ON) HandicapLight.Play() else: # If False, stop the sequence (light OFF / normal state) HandicapLight.Stop() # 4. INITIALIZATION # This runs once when the island starts. OnBegin() : void = # Subscribe to the timer's completion event. StartTimer.SuccessEvent.Subscribe(OnStartTimerFinished) # Start the timer loop. StartTimer.Start()