Verse Library verse

01 Device

Manages button interaction events to track puzzle progress and locks gameplay by canceling subscriptions.

verse-library/6-how-do-you-disable-player-interaction-after-the-puzzle-is-solved/01-device.verse

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

# Define our main script structure
tagged_lights_puzzle := class(creative_device):

    # 1. References to Button Devices placed in the level.
    # Wire these up in the UEFN editor Content Browser properties panel.
    @editable
    Button1 : button_device = button_device{}

    @editable
    Button2 : button_device = button_device{}

    # 2. The "Remote Controls" for our subscriptions.
    # We store these here so we can cancel them later.
    # Think of these as the "mute buttons" for each input.
    var ButtonSubscriptions : []cancelable = array{}

    # 3. The "State" of our puzzle.
    # False = Puzzle is active. True = Puzzle is solved.
    var IsSolved : logic = false

    # This function runs when the script starts.
    OnBegin<override>()<suspends> : void =
        # Subscribe to both buttons' interaction events.
        SubscribeToButtons()

    # Function to set up the listening.

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