Verse Library verse

01 Device

Links a button to a conditional device with team-based interaction restrictions.

verse-library/device-options/01-device.verse

# This is a comment. It helps humans read the code.
# The computer ignores comments.

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

# We create a new "Device" type called MyTeamSwitch.
# It has two parts: a Switch and a Door.
MyTeamSwitch := class(creative_device):
    # These are the "components" or parts of our device.
    # You assign real devices to these in the UEFN editor, on the Verse device actor.
    @editable
    SwitchDevice : button_device = button_device{}

    @editable
    DoorDevice : conditional_button_device = conditional_button_device{}
    # note: UEFN has no native DoorDevice API; conditional_button_device is the
    # closest real creative_device you can drop and wire up to a door prop.

    # This function runs when the game starts.
    OnBegin<override>()<suspends> : void =
        # We set a rule for the switch.
        # Only Blue Team (team index 1) can interact with it.
        # note: Verse has no SetActivationTeam method on button_device.
        # Team filtering is configured in the editor on the Button Device itself,
        # or checked here by reading the agent's team at runtime (see below).
        Agent := SwitchDevice.InteractedWithEvent.Await()

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