Verse Library verse

01 Device

Listens for player triggers. Activates devices like lights upon interaction.

verse-library/3-designing-levels/01-device.verse

# This is a Verse Device. It lives in your island.
# It watches for the player to push the box.

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

puzzle_manager := class(creative_device):

    # Wire these devices up in the editor's Details panel.
    # Select this device, then drag the matching object into each slot.

    # This is the trigger_device placed on the target zone.
    @editable
    PushTrigger : trigger_device = trigger_device{}

    # This is the customizable_light_device placed above the target.
    @editable
    TargetLight : customizable_light_device = customizable_light_device{}

    # This script runs when the device starts.
    OnBegin<override>()<suspends>: void =
        # Subscribe to the trigger's agent-entered event.
        # TriggeredEvent fires when an agent (player) activates the trigger.
        PushTrigger.TriggeredEvent.Subscribe(OnTriggerActivated)

        # Keep the device running so events keep firing.
        Sleep(Inf)

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