using { /Verse.org/Simulation } using { /Verse.org/Native } using { /UnrealEngine.com/Temporary/Diagnostics } using { /Fortnite.com/Devices } # HOW TO SET UP IN UEFN: # 1. Place a button_device in your level. # 2. Place a prop_mover_device in your level. # In its settings, position the prop off-screen or set # "Start Hidden" so it begins invisible. # 3. Select the button_device, click Add -> New Verse Component, # choose this file, then in the Details panel drag: # - your button_device -> LootButton # - your prop_mover_device -> TargetProp delayed_loot_component := class(creative_device): # We need a reference to the PropMover we placed in the world. # In UEFN, drag the PropMover into the 'TargetProp' slot in # the component properties panel. @editable TargetProp : prop_mover_device = prop_mover_device{} # Editable reference to the Button device in the level. @editable LootButton : button_device = button_device{} # OnBegin runs once at game start and subscribes to the button. OnBegin() : void = LootButton.InteractedWithEvent.Subscribe(OnButtonPressed) # Fires whenever any agent (player) interacts with the button. OnButtonPressed(Agent : agent) : void = # spawn: launches WaitThenDropLoot as its own async task so # the button stays responsive and the game never freezes. spawn: WaitThenDropLoot() # marks this as an async function — required for Sleep. WaitThenDropLoot() : void = # 1. Immediate Feedback Print("Loot is loading...") # 2. The Wait. # Sleep(5.0) pauses ONLY this coroutine for 5 seconds. # The rest of the game keeps running. Sleep(5.0) # 3. The Action — activate the pre-placed PropMover. # Activate() tells the PropMover to move/reveal the prop. TargetProp.Activate() Print("Loot is here!")