Verse Library verse

01 Device

Links collectible objects to conditional buttons, triggering door unlocks upon item pickup.

verse-library/using-lego-collectible-devices-in-fortnite-creative/01-device.verse

# This is a simple Verse script
# It connects a collectible to a door

using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }

# Our main game class wires the two devices together.
# In UEFN, set my_door and my_stud in the Details panel
# by tagging the placed devices with these property names.
treasure_hunt_manager := class(creative_device):

    # 1. Reference to the door device placed in the world
    @editable
    my_door : conditional_button_device = conditional_button_device{}

    # 2. Reference to the LEGO collectible device placed in the world
    @editable
    my_stud : collectible_object_device = collectible_object_device{}

    # OnBegin runs once when the game starts
    OnBegin<override>()<suspends> : void =
        # 3. Create the link
        # When the stud is collected...
        my_stud.CollectedEvent.Subscribe(OnStudCollected)

    # ...open the door!
    OnStudCollected(Agent : agent) : void =
        # Activate the conditional_button_device, which triggers
        # whatever action is wired to it in the Details panel
        # (set that action to "Unlock / Open" the door device).

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