Reference Devices compiles

vehicle_spawner_pickup_truck_device: Scripted Trucks That React to Players

The `vehicle_spawner_pickup_truck_device` lets you place a driveable pickup truck in your island and control every aspect of its lifecycle from Verse — spawn it on demand, assign a player as driver, destroy it, and listen for enter/exit events to drive game logic. Whether you're building a race mode, an escort mission, or a timed vehicle challenge, this device is your starting point for truck-based gameplay.

Updated Examples verified on the live UEFN compiler
Watch the Knotvehicle_spawner_pickup_truck_device in ~90 seconds.

Overview

The vehicle_spawner_pickup_truck_device is a concrete specialization of the abstract vehicle_spawner_device base class. Drop one into your UEFN level and you get a fully driveable pickup truck that Verse can control at runtime.

The game problem it solves: Without Verse scripting, a vehicle spawner just sits there and spawns a truck when the round starts. With Verse you can:

  • Delay the truck's appearance until a gate opens or a puzzle is solved.
  • Automatically assign the first player who steps on a trigger plate as the driver.
  • Respawn the truck after it's destroyed so the challenge can reset.
  • Award points or trigger events the moment a player climbs in or hops out.

When to reach for it:

  • Escort / convoy missions where one player drives and others defend.
  • Timed vehicle challenges that reset the truck between attempts.
  • Capture-the-flag variants where the truck is the "flag carrier" vehicle.
  • Any mode where you need programmatic control over vehicle state.

API Reference

vehicle_spawner_pickup_truck_device

Specialized vehicle_spawner_device that allows a pickup truck to be configured and spawned.

Full public surface, resolved verbatim from the live Epic digest (Fortnite.digest.verse). Inherited members are merged from vehicle_spawner_device.

vehicle_spawner_pickup_truck_device<public> := class<concrete><final>(vehicle_spawner_device):

Events (subscribe a handler to react):

Event Signature Description
AgentEntersVehicleEvent AgentEntersVehicleEvent<public>:listenable(agent) Signaled when an agent enters the vehicle. Sends the agent that entered the vehicle.
AgentExitsVehicleEvent AgentExitsVehicleEvent<public>:listenable(agent) Signaled when an agent exits the vehicle. Sends the agent that exited the vehicle.
SpawnedEvent SpawnedEvent<public>:listenable(fort_vehicle) Signaled when a vehicle is spawned or respawned by this device. Sends the fort_vehicle who was spawned.
VehicleSpawnedEvent VehicleSpawnedEvent<public>:listenable(tuple()) Signaled when a vehicle is spawned or respawned by this device. Deprecated, use SpawnedEvent instead.
VehicleDestroyedEvent VehicleDestroyedEvent<public>:listenable(tuple()) Signaled when a vehicle is destroyed. Deprecated, use DestroyedEvent instead.
DestroyedEvent DestroyedEvent<public>:listenable(tuple()) Signaled when a vehicle is destroyed.

Methods (call these to make the device act):

Method Signature Description
Enable Enable<public>():void Enables this device.
Disable Disable<public>():void Disables this device.
AssignDriver AssignDriver<public>(Agent:agent):void Sets agent as the vehicle's driver.
DestroyVehicle DestroyVehicle<public>():void Destroys the vehicle if it exists.
RespawnVehicle RespawnVehicle<public>():void Spawns a new vehicle. The previous vehicle will be destroyed before a new vehicle spawns.

vehicle_spawner_device

Base class for various specialized vehicle spawners which allow specific vehicle types to be spawned and configured with specialized options.

Full public surface, resolved verbatim from the live Epic digest (Fortnite.digest.verse).

vehicle_spawner_device<public> := class<abstract><epic_internal>(creative_device_base):

Events (subscribe a handler to react):

Event Signature Description
AgentEntersVehicleEvent AgentEntersVehicleEvent<public>:listenable(agent) Signaled when an agent enters the vehicle. Sends the agent that entered the vehicle.
AgentExitsVehicleEvent AgentExitsVehicleEvent<public>:listenable(agent) Signaled when an agent exits the vehicle. Sends the agent that exited the vehicle.
SpawnedEvent SpawnedEvent<public>:listenable(fort_vehicle) Signaled when a vehicle is spawned or respawned by this device. Sends the fort_vehicle who was spawned.
VehicleSpawnedEvent VehicleSpawnedEvent<public>:listenable(tuple()) Signaled when a vehicle is spawned or respawned by this device. Deprecated, use SpawnedEvent instead.
VehicleDestroyedEvent VehicleDestroyedEvent<public>:listenable(tuple()) Signaled when a vehicle is destroyed. Deprecated, use DestroyedEvent instead.
DestroyedEvent DestroyedEvent<public>:listenable(tuple()) Signaled when a vehicle is destroyed.

Methods (call these to make the device act):

Method Signature Description
Enable Enable<public>():void Enables this device.
Disable Disable<public>():void Disables this device.
AssignDriver AssignDriver<public>(Agent:agent):void Sets agent as the vehicle's driver.
DestroyVehicle DestroyVehicle<public>():void Destroys the vehicle if it exists.
RespawnVehicle RespawnVehicle<public>():void Spawns a new vehicle. The previous vehicle will be destroyed before a new vehicle spawns.

Walkthrough

Scenario: The Convoy Challenge

A trigger plate sits at the start line. When a player steps on it, the truck spawns and that player is automatically assigned as driver. A second trigger plate at the finish line destroys the truck and respawns it fresh for the next attempt. We also track enter/exit events to print a status message via a text device (or simply react in game logic).

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

# Localized helper so we can pass text to devices that accept `message`
StatusText<localizes>(S : string) : message = "{S}"

convoy_challenge_manager := class(creative_device):

    # The pickup truck spawner placed in the level
    @editable TruckSpawner : vehicle_spawner_pickup_truck_device = vehicle_spawner_pickup_truck_device{}

    # Trigger plate at the start line — player steps here to begin
    @editable StartPlate : trigger_device = trigger_device{}

    # Trigger plate at the finish line — destroys the truck and resets
    @editable FinishPlate : trigger_device = trigger_device{}

    # Called when the game session begins
    OnBegin<override>()<suspends> : void =
        # The truck should not exist yet — disable the spawner at start
        TruckSpawner.Disable()

        # Subscribe to the start plate so we know when a player steps on it
        StartPlate.TriggeredEvent.Subscribe(OnStartPlateTriggered)

        # Subscribe to the finish plate to reset the truck
        FinishPlate.TriggeredEvent.Subscribe(OnFinishPlateTriggered)

        # React when any agent enters the truck
        TruckSpawner.AgentEntersVehicleEvent.Subscribe(OnDriverEntered)

        # React when any agent exits the truck
        TruckSpawner.AgentExitsVehicleEvent.Subscribe(OnDriverExited)

        # React when the truck is fully spawned/respawned
        TruckSpawner.SpawnedEvent.Subscribe(OnTruckSpawned)

        # React when the truck is destroyed
        TruckSpawner.DestroyedEvent.Subscribe(OnTruckDestroyed)

    # A player stepped on the start plate
    OnStartPlateTriggered(Agent : ?agent) : void =
        # Unwrap the optional agent
        if (A := Agent?):
            # Enable the spawner and spawn the truck
            TruckSpawner.Enable()
            TruckSpawner.RespawnVehicle()
            # Assign this player as the driver immediately
            TruckSpawner.AssignDriver(A)

    # A player stepped on the finish plate — reset for next attempt
    OnFinishPlateTriggered(Agent : ?agent) : void =
        TruckSpawner.DestroyVehicle()

    # Called with the fort_vehicle that was spawned
    OnTruckSpawned(Vehicle : fort_vehicle) : void =
        # The truck is live — game logic can reference Vehicle here
        # e.g. start a countdown timer, open barriers, etc.
        var Dummy : int = 0  # placeholder for your game logic

    # An agent entered the vehicle
    OnDriverEntered(A : agent) : void =
        # e.g. start a race timer, lock the start gate, etc.
        var Dummy : int = 0  # placeholder for your game logic

    # An agent exited the vehicle
    OnDriverExited(A : agent) : void =
        # e.g. pause a timer, warn the player to get back in, etc.
        var Dummy : int = 0  # placeholder for your game logic

    # The truck was destroyed
    OnTruckDestroyed() : void =
        # Disable the spawner until the next start-plate press
        TruckSpawner.Disable()```

**Line-by-line highlights:**

| Line / block | What it does |
|---|---|
| `TruckSpawner.Disable()` | Prevents the truck from auto-spawning at round start  we control the moment it appears. |
| `StartPlate.TriggeredEvent.Subscribe(OnStartPlateTriggered)` | Wires the trigger plate to our handler. |
| `TruckSpawner.AgentEntersVehicleEvent.Subscribe(OnDriverEntered)` | `AgentEntersVehicleEvent` sends a plain `agent` (not optional), so the handler signature is `(A : agent)`. |
| `TruckSpawner.SpawnedEvent.Subscribe(OnTruckSpawned)` | `SpawnedEvent` sends a `fort_vehicle`  use this instead of the deprecated `VehicleSpawnedEvent`. |
| `if (A := Agent?)` | The trigger plate's `TriggeredEvent` sends `?agent`; we must unwrap before calling `AssignDriver`. |
| `TruckSpawner.RespawnVehicle()` | Destroys any existing truck and spawns a fresh one. |
| `TruckSpawner.AssignDriver(A)` | Puts the player in the driver's seat immediately after spawn. |
| `TruckSpawner.DestroyVehicle()` | Removes the truck; triggers `DestroyedEvent`. |

## Common patterns

### Pattern 1 — Enable/Disable the spawner based on a team score

Only allow the truck to exist while Team 1 is winning. A score manager calls these helpers.

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

team_truck_controller := class(creative_device):

    @editable TruckSpawner : vehicle_spawner_pickup_truck_device = vehicle_spawner_pickup_truck_device{}
    @editable TeamScoreDevice : score_manager_device = score_manager_device{}

    OnBegin<override>()<suspends> : void =
        # Start with the spawner off
        TruckSpawner.Disable()
        # Listen for score changes (score_manager fires TeamScoreChangedEvent)
        TeamScoreDevice.ScoreChangedEvent.Subscribe(OnScoreChanged)

    # Enable the truck only when the score crosses a threshold
    OnScoreChanged(Score : int) : void =
        if (Score >= 3):
            TruckSpawner.Enable()
            TruckSpawner.RespawnVehicle()
        else:
            TruckSpawner.DestroyVehicle()
            TruckSpawner.Disable()

Pattern 2 — Auto-assign the first player who enters as driver

Useful when you want the truck to be pre-spawned but driverless, and the first person to climb in is locked in as driver (e.g., a king-of-the-hill truck).

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

king_truck_manager := class(creative_device):

    @editable TruckSpawner : vehicle_spawner_pickup_truck_device = vehicle_spawner_pickup_truck_device{}

    # Track whether a driver has been assigned this round
    var DriverAssigned : logic = false

    OnBegin<override>()<suspends> : void =
        TruckSpawner.AgentEntersVehicleEvent.Subscribe(OnAgentEnters)
        TruckSpawner.AgentExitsVehicleEvent.Subscribe(OnAgentExits)
        # Truck is already configured to spawn at round start via device settings

    OnAgentEnters(A : agent) : void =
        if (not DriverAssigned):
            set DriverAssigned = true
            # Formally assign this agent as driver
            TruckSpawner.AssignDriver(A)

    OnAgentExits(A : agent) : void =
        # Reset so the next person to enter becomes the new driver
        set DriverAssigned = false

Pattern 3 — Respawn the truck on destruction with a countdown

After the truck is destroyed, wait 5 seconds and respawn it automatically — great for a demolition derby respawn loop.

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

demo_derby_respawner := class(creative_device):

    @editable TruckSpawner : vehicle_spawner_pickup_truck_device = vehicle_spawner_pickup_truck_device{}

    OnBegin<override>()<suspends> : void =
        TruckSpawner.DestroyedEvent.Subscribe(OnTruckDestroyed)

    OnTruckDestroyed() : void =
        # Spawn an async task so we don't block the event handler
        spawn { RespawnAfterDelay() }

    RespawnAfterDelay()<suspends> : void =
        # Wait 5 seconds before bringing the truck back
        Sleep(5.0)
        TruckSpawner.RespawnVehicle()

Gotchas

1. AgentEntersVehicleEvent sends agent, not ?agent

AgentEntersVehicleEvent and AgentExitsVehicleEvent hand your handler a plain agent — no optional unwrap needed. Contrast this with many trigger devices whose TriggeredEvent sends ?agent. Getting the signature wrong causes a compile error.

# CORRECT
OnDriverEntered(A : agent) : void = ...

# WRONG — will not compile
OnDriverEntered(A : ?agent) : void = ...

2. SpawnedEvent vs. VehicleSpawnedEvent

Always use SpawnedEvent — it sends the actual fort_vehicle so you can reference the vehicle object. VehicleSpawnedEvent sends an empty tuple () and is deprecated. Same story for DestroyedEvent vs. VehicleDestroyedEvent.

3. RespawnVehicle() destroys the existing truck first

Calling RespawnVehicle() when a truck already exists will destroy it (firing DestroyedEvent) before spawning the new one. If your DestroyedEvent handler calls RespawnVehicle() again you'll create an infinite loop. Use the Pattern 3 approach (spawn an async task with a delay) to break the cycle.

4. AssignDriver() requires the vehicle to already exist

Call AssignDriver() after RespawnVehicle() has had time to spawn the truck. In practice, subscribing to SpawnedEvent and calling AssignDriver() from that handler (or calling it in the same synchronous frame after RespawnVehicle()) is the safest approach.

5. @editable is mandatory for placed devices

You cannot write var T := vehicle_spawner_pickup_truck_device{} and expect it to control the truck you placed in the level. You must declare it as @editable so the editor can wire the placed device to your Verse field.

# CORRECT — wires to the placed device
@editable TruckSpawner : vehicle_spawner_pickup_truck_device = vehicle_spawner_pickup_truck_device{}

# WRONG — creates a detached default object, does nothing in-world
var TruckSpawner : vehicle_spawner_pickup_truck_device = vehicle_spawner_pickup_truck_device{}

6. Disable() does not destroy an existing truck

Calling Disable() prevents the spawner from creating new trucks but does not remove a truck that is already in the world. Call DestroyVehicle() first if you want the truck gone, then Disable().

Guides & scripts that use vehicle_spawner_pickup_truck_device

Step-by-step tutorials that put this object to work.

Build your own lesson with vehicle_spawner_pickup_truck_device

Generate a personalized, step-by-step lesson plan built around this object — grounded in this exact reference and our compile-verified knowledge base.

Build a lesson →