Verse Library verse

01 Device

Connects a signal remote button press to a teleporter device to instantly move the player.

verse-library/restock-remote/01-device.verse

# This is a simple Verse script for a Restock Remote
# It connects a button press to a teleport action

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

# This is our main device. It holds everything together.
restock_remote_device := class(creative_device):

    # This is the remote manager. It listens for button presses.
    # Connect this to your Signal Remote Manager in the UEFN details panel.
    @editable
    SignalManager : signal_remote_manager_device = signal_remote_manager_device{}

    # This is the teleporter. It moves the player.
    # Connect this to your Teleporter device in the UEFN details panel.
    @editable
    Teleporter : teleporter_device = teleporter_device{}

    # This function runs when the game starts.
    OnBegin<override>()<suspends> : void =
        # We connect the "PrimarySignal" event to our handler function.
        # This means: "When the button is pressed, run OnPrimaryFire."
        SignalManager.PrimarySignalEvent.Subscribe(OnPrimaryFire)

    # This function runs each time the primary fire button is pressed.
    # It receives the agent (the player) who pressed the button.
    OnPrimaryFire(Agent : agent) : void =
        # This tells the teleporter to activate for the player who pressed the button.
        Teleporter.Teleport(Agent)

Comments

    Sign in to vote, comment, or suggest an edit. Sign in