# This is the main script for our rescue game. # It connects a button device to a helicopter spawner device. using { /Fortnite.com/Devices } using { /Verse.org/Simulation } # We define our script here. # This is like the name tag for our code. helicopter_rescue_script := class(creative_device): # Declare the button and helicopter spawner devices. # Drag each device into these slots in the editor's Details panel. @editable RescueButton : button_device = button_device{} @editable RescueSpawner : helicopter_spawner_device = helicopter_spawner_device{} # This function runs when the game starts. # It sets up the connections. OnBegin() : void = # Connect the button's InteractedWithEvent to our spawn function. # When any player presses the button, SpawnHelicopter is called. RescueButton.InteractedWithEvent.Subscribe(SpawnHelicopter) # This function makes the helicopter appear. # It receives the agent (player) who pressed the button. SpawnHelicopter(Agent : agent) : void = # This line tells the spawner to create a helicopter. # It uses the spawner device's placement in the editor. RescueSpawner.SpawnVehicle() # Print a message to the console to know it worked. Print("Helicopter is ready for rescue!")