using { /Fortnite.com/Devices } using { /Verse.org/Simulation } using { /UnrealEngine.com/Temporary/Diagnostics } # This is our main Game Coordinator device # Think of it as the 'Referee' of the match game_coordinator_device := class(creative_device): # A trigger device the player walks into to start the race # Wire this up in the UEFN editor to your start-zone trigger @editable StartTrigger : trigger_device = trigger_device{} # A trigger device the player walks into to pick up a pizza # Wire this up in the UEFN editor to your pickup-zone trigger @editable PickupTrigger : trigger_device = trigger_device{} # A trigger device the player walks into to deliver a pizza # Wire this up in the UEFN editor to your delivery-zone trigger @editable DeliveryTrigger : trigger_device = trigger_device{} # Tracks how many pizzas have been delivered var PizzasDelivered : int = 0 # How many pizzas the player must deliver to win PizzasToWin : int = 5 # Tracks remaining time in seconds var TimeRemaining : float = 60.0 # Whether a delivery was made in the current pickup cycle var DeliveryMade : logic = false # OnBegin is the real entry point for a creative_device in UEFN # It runs automatically when the island session starts OnBegin() : void = # STATE 1: Wait for the player to start the race # We pause here until the player enters the Start Zone trigger StartTrigger.TriggeredEvent.Await() Print("Race started!") # STATE 2: The main game loop # Runs repeatedly until the player wins or time runs out loop: # Reset the delivery flag for this round set DeliveryMade = false Print("New pizza location selected - head to the pickup zone!") # Wait here until the player actually picks up the pizza # Await pauses the code until the trigger fires, # saving CPU power instead of checking every frame PickupTrigger.TriggeredEvent.Await() Print("Pizza picked up! Now deliver it!") # Wait for the player to reach the delivery zone DeliveryTrigger.TriggeredEvent.Await() # Player reached the delivery zone — count the delivery set DeliveryMade = true set PizzasDelivered = PizzasDelivered + 1 Print("Pizza delivered! Total: {PizzasDelivered}") # Add more time to the clock (like a heal pack for the timer) set TimeRemaining = TimeRemaining + 10.0 Print("Bonus time! Time remaining: {TimeRemaining}") # Check win condition: enough pizzas delivered? if (PizzasDelivered >= PizzasToWin): Print("You Win! All pizzas delivered!") break # Stop the loop — we won! # Check loss condition: did time run out? if (TimeRemaining <= 0.0): Print("Time's up! Game Over!") break # Stop the loop — we lost! # STATE 3: Game Over # This runs once after the loop breaks ShowGameOverScreen() # Displays the final result to all players # Print() writes to the UEFN output log; swap in a # hud_message_device wired in the editor for in-game text ShowGameOverScreen() : void = if (PizzasDelivered >= PizzasToWin): Print("=== YOU WIN! Pizza Pursuit Complete! ===") else: Print("=== GAME OVER! Better luck next time! ===")