using { /Fortnite.com/Devices } using { /Fortnite.com/Characters } using { /Verse.org/Simulation } using { /UnrealEngine.com/Temporary/Diagnostics } # This is our main script. It controls the victory gate. WinnerGate := class(creative_device): # These are the devices we will use. # Think of them as tools in your toolbox. @editable VictoryTrigger : trigger_device = trigger_device{} @editable ItemGranter : item_granter_device = item_granter_device{} @editable Accolades : accolades_device = accolades_device{} # This runs when the game starts. OnBegin() : void = # Wait for the player to step on the trigger. # This is like waiting for a bell to ring. loop: # TriggeredEvent fires each time the trigger activates. MaybeAgent := VictoryTrigger.TriggeredEvent.Await() # The player stepped on the button! # Let's give them a reward. # TriggeredEvent returns a ?agent, so we unwrap it first. if (Agent := MaybeAgent?): # 1. Give them an item via the Item Granter device. # The Item Granter's inventory is configured in the editor. # Calling GrantItem() tells it to give its configured item # to the agent who activated the trigger. # # note: item_granter_device.GrantItem() accepts an agent # and grants whatever item is set up in the device properties. ItemGranter.GrantItem(Agent) # 2. Give them an accolade (XP and badge). # The accolade name and XP value are set in the editor. # Calling Award() triggers the device for this agent. # # note: accolades_device.Award() signals the device to # display the configured accolade for the given agent. Accolades.Award(Agent) # 3. Print a debug message confirming the reward fired. # Use a HUD Message device in the editor for in-game text. # # note: Print() writes to the output log; place a # hud_message_controller_device in the editor to show # on-screen text to players. Print("You Won! Great Job!")