# This is our main script. It runs when the game starts. using { /Fortnite.com/Devices } using { /Verse.org/Simulation } using { /UnrealEngine.com/Temporary/Diagnostics } # We create a new class. Think of this as a blueprint. # It holds the data for our power-up zone. # Attach this device to a Verse Device in the editor. power_up_zone := class(creative_device): # These two variables are set in the editor by dragging # devices onto the Verse Device's property panel. # SkydiveVolume lets us detect when a player enters the zone. @editable EntryVolume : skydive_volume_device = skydive_volume_device{} # RocketBoostDevice is the power-up we will activate. @editable PowerUpDevice : health_powerup_device = health_powerup_device{} # This function runs when the game starts. OnBegin() : void = # We subscribe to the EntryVolume's AgentEntersEvent. # This means: "When a player enters the volume, call OnPlayerEntered." EntryVolume.AgentEntersEvent.Subscribe(OnPlayerEntered) # This event happens when a player enters the volume. # The agent parameter is the player who stepped inside. OnPlayerEntered(Agent : agent) : void = # Enable the Power-Up device. # This turns the power-up on so the player can collect it! PowerUpDevice.Enable() # note: powerup_device exposes Enable/Disable but not # runtime BoostDuration or BoostSpeed fields; set those values # in the device's editor property panel before running the game.