Reference Devices compiles

vehicle_spawner_dirtbike_device: Scripted Bikes That React to Riders

The `vehicle_spawner_dirtbike_device` puts a fully scriptable dirtbike on your island — and hands you Verse hooks for every moment that matters: when the bike spawns, when a rider hops on, when they bail, and when the bike gets wrecked. Whether you're building a motocross race, a timed escape sequence, or a patrol system where an NPC always has a ride waiting, this device is your starting point.

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

Overview

The vehicle_spawner_dirtbike_device is a concrete specialization of vehicle_spawner_device that spawns a dirtbike at a designated location in your UEFN level. Beyond simply placing a bike, it exposes a rich Verse API that lets you:

  • React to riders — know the instant an agent mounts or dismounts.
  • React to the vehicle lifecycle — detect spawns and destructions to update scoreboards, trigger cinematics, or spawn replacements.
  • Drive the bike programmatically — force a specific player into the driver's seat, destroy the current bike, or respawn a fresh one on demand.

Reach for this device whenever your game needs a dirtbike that behaves differently based on who is riding it, how long they've been on it, or what happened to it.

API Reference

vehicle_spawner_dirtbike_device

Specialized vehicle_spawner_device that allows a dirtbike 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_dirtbike_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: Timed Motocross Gate

A player enters a starting zone (trigger plate), the dirtbike spawns and is immediately assigned to them, a countdown begins, and when they dismount the bike is destroyed and their lap time is broadcast.

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

# Place this Verse device in your level alongside a
# vehicle_spawner_dirtbike_device and a trigger_device (start gate).
motocross_manager_device := class(creative_device):

    # Wire up in the Details panel
    @editable
    DirtbikeSpawner : vehicle_spawner_dirtbike_device = vehicle_spawner_dirtbike_device{}

    @editable
    StartGate : trigger_device = trigger_device{}

    # Tracks when the lap started (seconds since level begin)
    var LapStartTime : float = 0.0

    # Localised message helper
    LapMessage<localizes>(S : string) : message = "{S}"

    OnBegin<override>()<suspends> : void =
        # Subscribe to the start gate — a player stepping on it kicks off the lap
        StartGate.TriggeredEvent.Subscribe(OnGateTriggered)

        # React to the bike spawning so we know a fresh vehicle is ready
        DirtbikeSpawner.SpawnedEvent.Subscribe(OnBikeSpawned)

        # React to the rider dismounting to record the lap
        DirtbikeSpawner.AgentExitsVehicleEvent.Subscribe(OnRiderDismounted)

        # React to the bike being destroyed (e.g. blown up mid-lap)
        DirtbikeSpawner.DestroyedEvent.Subscribe(OnBikeDestroyed)

    # Called when a player steps on the start-gate trigger
    OnGateTriggered(Agent : ?agent) : void =
        if (A := Agent?):
            # Destroy any existing bike and spawn a fresh one at the spawner location
            DirtbikeSpawner.RespawnVehicle()
            # AssignDriver is called after SpawnedEvent fires (see OnBikeSpawned)
            # Store the agent so OnBikeSpawned can assign them
            # For simplicity we assign immediately — the bike is already present
            # or will be ready after RespawnVehicle completes its spawn sequence.
            DirtbikeSpawner.AssignDriver(A)
            set LapStartTime = GetSimulationElapsedTime()

    # Called when SpawnedEvent fires — receives the fort_vehicle that was spawned
    OnBikeSpawned(Vehicle : fort_vehicle) : void =
        # The bike is live; nothing extra needed here for this scenario,
        # but you could store the fort_vehicle reference for later use.
        var Dummy : fort_vehicle = Vehicle  # suppress unused-variable warning

    # Called when the rider exits the vehicle
    OnRiderDismounted(Agent : agent) : void =
        ElapsedTime : float = GetSimulationElapsedTime() - LapStartTime
        # Destroy the bike so it can't be re-used without triggering the gate again
        DirtbikeSpawner.DestroyVehicle()

    # Called when the bike is destroyed for any reason
    OnBikeDestroyed(Empty : tuple()) : void =
        # Re-enable the spawner so the next rider can trigger a fresh spawn
        DirtbikeSpawner.Enable()```

### Line-by-line explanation

| Lines | What's happening |
|---|---|
| `@editable` fields | Wires the placed devices into Verse at edit time — mandatory for any device reference. |
| `StartGate.TriggeredEvent.Subscribe(OnGateTriggered)` | Listens for a player stepping on the start plate. |
| `DirtbikeSpawner.SpawnedEvent.Subscribe(OnBikeSpawned)` | Uses the modern (non-deprecated) `SpawnedEvent` which delivers the actual `fort_vehicle`. |
| `DirtbikeSpawner.AgentExitsVehicleEvent.Subscribe(OnRiderDismounted)` | Fires the moment the rider leaves the seat — perfect for stopping a timer. |
| `DirtbikeSpawner.DestroyedEvent.Subscribe(OnBikeDestroyed)` | Catches destruction from any source (combat, out-of-bounds, `DestroyVehicle()`). |
| `RespawnVehicle()` | Destroys the old bike (if any) and spawns a brand-new one. |
| `AssignDriver(A)` | Forces the triggering player into the driver's seat immediately. |
| `DestroyVehicle()` | Cleans up the bike after the lap ends so it can't be re-ridden without a new gate trigger. |
| `OnBikeDestroyed` handler | Re-enables the spawner so the gate works again next round. |

---

## Common patterns

### Pattern 1 — Disable the bike spawner until a race starts, then enable it

Use `Enable` / `Disable` to gate access to the bike behind a game-flow condition (e.g., waiting for all players to ready up).

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

bike_gate_controller := class(creative_device):

    @editable
    DirtbikeSpawner : vehicle_spawner_dirtbike_device = vehicle_spawner_dirtbike_device{}

    @editable
    ReadyButton : button_device = button_device{}

    OnBegin<override>()<suspends> : void =
        # Bike is off-limits until the ready button is pressed
        DirtbikeSpawner.Disable()
        ReadyButton.InteractedWithEvent.Subscribe(OnReadyPressed)

    OnReadyPressed(Agent : agent) : void =
        # Open the gates — the spawner will now produce a bike
        DirtbikeSpawner.Enable()
        DirtbikeSpawner.RespawnVehicle()

Pattern 2 — Auto-assign the bike to whoever mounts it first, then lock it

Subscribe to AgentEntersVehicleEvent to capture the first rider and immediately call AssignDriver to lock them in.

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

bike_lock_device := class(creative_device):

    @editable
    DirtbikeSpawner : vehicle_spawner_dirtbike_device = vehicle_spawner_dirtbike_device{}

    var BikeClaimedByAgent : logic = false

    OnBegin<override>()<suspends> : void =
        DirtbikeSpawner.AgentEntersVehicleEvent.Subscribe(OnAgentEnters)
        # Also reset the claim when the bike is destroyed
        DirtbikeSpawner.DestroyedEvent.Subscribe(OnBikeDestroyed)

    OnAgentEnters(Agent : agent) : void =
        if (not BikeClaimedByAgent?):
            # First rider claims the bike
            DirtbikeSpawner.AssignDriver(Agent)
            set BikeClaimedByAgent = true

    OnBikeDestroyed(Empty : tuple()) : void =
        # Reset so the next spawned bike can be claimed again
        set BikeClaimedByAgent = false

Pattern 3 — Respawn the bike automatically after it's destroyed

Use DestroyedEvent to trigger RespawnVehicle() after a short delay, keeping a bike always available on the map.

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

bike_respawn_loop_device := class(creative_device):

    @editable
    DirtbikeSpawner : vehicle_spawner_dirtbike_device = vehicle_spawner_dirtbike_device{}

    # Seconds to wait before respawning after destruction
    @editable
    RespawnDelay : float = 5.0

    OnBegin<override>()<suspends> : void =
        DirtbikeSpawner.DestroyedEvent.Subscribe(OnBikeDestroyed)

    OnBikeDestroyed(Empty : tuple()) : void =
        # Kick off an async respawn after the configured delay
        spawn { DelayedRespawn() }

    DelayedRespawn()<suspends> : void =
        Sleep(RespawnDelay)
        DirtbikeSpawner.RespawnVehicle()

Gotchas

1. AgentEntersVehicleEvent sends agent, not ?agent

Unlike trigger events (which send ?agent), AgentEntersVehicleEvent and AgentExitsVehicleEvent deliver a plain agent — no optional unwrap needed. Don't write if (A := Agent?): here; just use Agent directly.

2. SpawnedEvent vs. VehicleSpawnedEvent — use the modern one

VehicleSpawnedEvent and VehicleDestroyedEvent are deprecated. Always subscribe to SpawnedEvent (which gives you the fort_vehicle) and DestroyedEvent instead. The deprecated events send tuple() and carry no useful payload.

3. DestroyedEvent fires for ALL destruction sources

This includes DestroyVehicle() calls from your own code, combat damage, and out-of-bounds resets. If you call DestroyVehicle() and then immediately subscribe a respawn, you'll get an infinite loop. Guard with a flag or unsubscribe before destroying.

4. RespawnVehicle() destroys the current bike first

Calling RespawnVehicle() when a bike already exists will destroy it — triggering DestroyedEvent — before the new one spawns. If you have auto-respawn logic listening on DestroyedEvent, this will cause a double-respawn. Use a boolean guard to suppress the handler during intentional respawns.

5. @editable is mandatory

You cannot reference a placed vehicle_spawner_dirtbike_device with a bare local variable. It must be declared as an @editable field on your creative_device class and wired in the UEFN Details panel. A bare vehicle_spawner_dirtbike_device{} creates a default (non-placed) instance that has no effect in the world.

6. No using lines in your snippet? They're required at file scope

Every file that references vehicle_spawner_dirtbike_device must include using { /Fortnite.com/Devices } and using { /Verse.org/Simulation } at the top. The compile gate adds them automatically for this site's examples, but in your own project they are mandatory.

Device Settings & Options

The vehicle_spawner_dirtbike_device User Options panel in the UEFN editor — every setting you can tune.

Vehicle Spawner Dirtbike Device settings and options panel in the UEFN editor — Visible During Game, Visual Variants
Vehicle Spawner Dirtbike Device — User Options in the UEFN editor: Visible During Game, Visual Variants
⚙️ Settings on this device (2)

Setting names read from the panel above — may be partial; the screenshots are the source of truth.

Visible During Game
Visual Variants

Build your own lesson with vehicle_spawner_dirtbike_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 →