Verse Library verse

02 Device

Pauses execution after a button press before triggering a device, useful for timed rewards or sequence delays.

verse-library/wait-5-seconds/02-device.verse

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<override>()<suspends> : void =
        LootButton.InteractedWithEvent.Subscribe(OnButtonPressed)

Sign in free to read the full source 🌴

This Verse Library file is members-only. Create a free account to view the complete source and download the .verse file.

Sign in with Discord

Comments

    Sign in to vote, comment, or suggest an edit. Sign in