# This is our main script. # It connects the trigger to the spawner. using { /Fortnite.com/Devices } using { /Verse.org/Simulation } # We create a "Device Table". # Think of this as a list of devices we control. # We give them simple names. ufo_race_manager := class(creative_device): # The trigger that starts the game @editable StartTrigger : trigger_device = trigger_device{} # The spawner that creates the UFO # note: ufo_spawner_device is the real Verse type for the UFO Spawner device. @editable UfoSpawner : ufo_spawner_device = ufo_spawner_device{} # OnBegin runs automatically when the game starts. # This is where we wire up our event listeners. OnBegin() : void = # This is an "Event". # An event is a signal. It says "Hey! Something happened!" # Here, we listen for when the trigger is pressed. StartTrigger.TriggeredEvent.Subscribe(OnStartTriggered) # This function runs when the trigger fires. # agent? means the triggering agent (player) may or may not exist. OnStartTriggered(Agent : ?agent) : void = # When triggered, we call our function. SpawnTheUfo() # This is a "Function". # A function is a recipe. It is a set of steps. # We name it SpawnTheUfo. SpawnTheUfo() : void = # This line tells the spawner to make a UFO. # It uses the "Enable" action, which respawns the vehicle. # note: ufo_spawner_device exposes Enable() to activate/respawn the UFO. UfoSpawner.Enable() # Optional: Print a message to the console. # This helps you debug. Print("UFO Spawned! Go drive!")