Verse Library verse

01 Device

Spawns a pickup truck and seats a player automatically when a nearby trigger device is activated.

verse-library/using-pickup-truck-spawner-devices-in-fortnite-creative/01-device.verse

# We are defining a script that lives inside a Device.
# Think of this as the "brain" of the spawner pad.
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }

# This is our main script structure.
# It inherits from creative_device, meaning it can interact with devices.
spawn_truck_script := class(creative_device):

    # This is a VARIABLE.
    # In game terms, this is like the "Team Number" setting on a device.
    # It changes per instance of this script.
    # Wire this to a Pickup Truck Spawner device in the UEFN editor.
    @editable
    TruckSpawner : pickup_truck_spawner_device = pickup_truck_spawner_device{}

    # This is a VARIABLE.
    # Wire this to a Trigger device (e.g. a pressure plate) in the UEFN editor.
    # The trigger fires AgentEntersEvent when a player steps on it.
    @editable
    SpawnTrigger : trigger_device = trigger_device{}

    # This is the ENTRY POINT.
    # OnBegin runs automatically when the island starts.
    # It connects the trigger's built-in Event to our Function.
    # It says: "When a player steps on SpawnTrigger, run SpawnAndSeatPlayer."
    OnBegin<override>()<suspends> : void =
        SpawnTrigger.TriggeredEvent.Await()
        SpawnAndSeatPlayer()

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