# This is the main script for our secret weapon. # It runs when the island starts. using { /Fortnite.com/Devices } using { /Fortnite.com/Characters } using { /Verse.org/Simulation } using { /UnrealEngine.com/Temporary/Diagnostics } # We create a new object called SecretWeapon. # This object holds our logic. SecretWeapon := class(creative_device): # This is the Item Placer device. # We will connect it later in the editor. @editable my_placer : item_spawner_device = item_spawner_device{} # This is the function that runs first. # It sets up the game. OnBegin() : void = # We wait for a player to interact. # When they touch the placer, this runs. my_placer.ItemPickedUpEvent.Subscribe(OnItemPickedUp) # This function runs when a player picks up the item. OnItemPickedUp(Agent : agent) : void = # We start a background task. # It will wait 5 seconds and then reset the placer. spawn{ ResetAfterDelay() } # This is the function that waits, then resets. ResetAfterDelay() : void = # We wait for 5 seconds. Sleep(5.0) # We put the item back in the placer. my_placer.Enable()