Verse Library verse

01 Device

Wires a conditional button, door guard, and item spawner to create a key-based unlock system.

verse-library/using-the-conditional-button-device-for-puzzles/01-device.verse

# This script makes a smart door lock
# It waits for the player to have a key item

using { /Fortnite.com/Devices }
using { /Fortnite.com/Game }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }

# A Verse device that wires a conditional_button_device
# to a door_guard_device (the closest real "lock" device in UEFN).
# note: UEFN exposes door_guard_device for locking/unlocking doors;
#       there is no standalone LockDevice class in the public Verse API.
MySmartLock := class(creative_device):

    # Drag-and-drop these in the UEFN outliner after placing the device.
    @editable
    MyDoorGuard : door_guard_device = door_guard_device{}

    @editable
    MyButton : conditional_button_device = conditional_button_device{}

    @editable
    MyItemGranter : item_spawner_device = item_spawner_device{}

    # OnBegin runs automatically when the game session starts.
    OnBegin<override>()<suspends> : void =
        # Disable the button so players cannot press it yet.
        MyButton.Disable()

        # Subscribe to the button's activated event.

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