Verse Library verse

01 Device

Configures and starts a prop mover at a set speed when the game begins.

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

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

# This is our main script. It connects to a Prop Mover device.
# We call this a "Device Script".
MoveWithSpeed := class(creative_device):
    # This is the device we are controlling.
    # It must be a Prop Mover.
    # Drag the Prop Mover from the Outliner onto this slot in the Details Panel.
    @editable
    Mover: prop_mover_device = prop_mover_device{}

    # This is our User Option.
    # It is a number. Players can change it in the editor.
    # The default value is 10.0.
    @editable
    TravelSpeed: float = 10.0

    # This function runs when the game starts.
    OnBegin<override>()<suspends>: void =
        # We enable the Prop Mover so it is ready to receive commands.
        Mover.Enable()

        # We tell the mover to travel at the speed defined by TravelSpeed.
        # The Prop Mover moves along the path set up in the editor.
        # SetTargetSpeed controls how fast it travels along that path.
        # note: prop_mover_device does not expose a velocity vector API;
        #       SetTargetSpeed(float) is the closest real method available.
        Mover.SetTargetSpeed(TravelSpeed)

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