Reference Devices compiles

vehicle_spawner_df9_device: DF.9 Turrets on Demand

The DF.9 turret is a defensive emplacement that players climb into and fire from. The vehicle_spawner_df9_device lets you place that turret in your map and drive it entirely from Verse — spawn it, destroy it, force a player into the seat, and react when someone climbs in or the turret is blown up. This article shows the real API doing real defense-game work.

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

Overview

A vehicle_spawner_df9_device is a specialized vehicle_spawner_device that spawns a DF.9 turret — the heavy stationary gun players board to defend a point. Reach for it whenever your mode needs a controllable emplacement: a base-defense round where each defender gets a turret, a boss arena where the turret respawns after it's destroyed, or a king-of-the-hill point that hands the holder a gun seat.

Because vehicle_spawner_df9_device inherits from vehicle_spawner_device, every method and event below is shared with the other spawners (tank, UFO, valet SUV, etc.) — learn this one and you know them all. The device gives you five methods to act on the turret (Enable, Disable, AssignDriver, DestroyVehicle, RespawnVehicle) and six events to react to its life cycle (SpawnedEvent, DestroyedEvent, AgentEntersVehicleEvent, AgentExitsVehicleEvent, plus the deprecated VehicleSpawnedEvent / VehicleDestroyedEvent).

The key idea: the spawner is a factory and remote control for one turret at a time. RespawnVehicle() always replaces the current turret with a fresh one, and SpawnedEvent hands you the actual fort_vehicle so you can query fuel, occupants, or teleport it.

API Reference

vehicle_spawner_df9_device

Specialized vehicle_spawner_device that allows a DF.9 turret 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_df9_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

Let's build a base-defense turret station. We place a DF.9 spawner and a trigger. When a player steps on the trigger, we respawn a fresh turret and force that player into the driver's seat. When the turret is destroyed, we announce it and automatically rebuild it after the player exits. We use RespawnVehicle, AssignDriver, SpawnedEvent, DestroyedEvent, AgentEntersVehicleEvent, and AgentExitsVehicleEvent — most of the surface in one device.

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

# A turret station: step on the trigger, get a fresh DF.9 turret and the driver seat.
turret_station := class(creative_device):

    # The DF.9 spawner placed in the level.
    @editable
    Spawner : vehicle_spawner_df9_device = vehicle_spawner_df9_device{}

    # A trigger players step on to claim the turret.
    @editable
    ClaimTrigger : trigger_device = trigger_device{}

    # Localized text helper (message params never take raw strings).
    Announce<localizes>(S : string) : message = "{S}"

    OnBegin<override>()<suspends>:void =
        # React to the turret life cycle.
        Spawner.SpawnedEvent.Subscribe(OnTurretSpawned)
        Spawner.DestroyedEvent.Subscribe(OnTurretDestroyed)
        Spawner.AgentEntersVehicleEvent.Subscribe(OnEnter)
        Spawner.AgentExitsVehicleEvent.Subscribe(OnExit)

        # When a player steps on the plate, give them a turret.
        ClaimTrigger.TriggeredEvent.Subscribe(OnClaim)

    # trigger_device hands us a ?agent; unwrap before using it.
    OnClaim(MaybeAgent : ?agent) : void =
        if (Player := MaybeAgent?):
            # Replace any existing turret with a fresh one.
            Spawner.RespawnVehicle()
            # Put the claiming player straight into the driver seat.
            Spawner.AssignDriver(Player)

    # SpawnedEvent gives us the real fort_vehicle that was created.
    OnTurretSpawned(Vehicle : fort_vehicle) : void =
        # Query something concrete on the spawned vehicle.
        Fuel := Vehicle.GetFuelRemaining()
        Print("DF.9 turret spawned. Fuel remaining: {Fuel}")

    # DestroyedEvent carries no payload (tuple()).
    OnTurretDestroyed() : void =
        Print("The turret was destroyed! Rebuilding shortly...")

    OnEnter(Agent : agent) : void =
        Print("A defender boarded the turret.")

    OnExit(Agent : agent) : void =
        # When the seat empties, refresh the emplacement for the next player.
        Spawner.RespawnVehicle()

Line by line:

  • Spawner : vehicle_spawner_df9_device — this @editable field is how Verse reaches the placed device. Without it, calling Spawner.RespawnVehicle() would fail with Unknown identifier. After building, you bind it in the device's Details panel.
  • In OnBegin, we subscribe four spawner events plus the trigger's TriggeredEvent. Subscriptions live in OnBegin; the handlers are methods at class scope.
  • OnClaim receives ?agent from the trigger. We unwrap with if (Player := MaybeAgent?). Then RespawnVehicle() destroys the old turret (if any) and spawns a new one, and AssignDriver(Player) seats them.
  • OnTurretSpawned receives a fort_vehicle — the actual spawned turret. We call GetFuelRemaining() to prove we have a live vehicle handle.
  • DestroyedEvent is listenable(tuple()), so OnTurretDestroyed takes no parameters.
  • OnExit rebuilds the turret so it's ready for the next defender.

Common patterns

Toggle the station with Enable / Disable

During a build phase you might want the turret spawner inactive, then switch it on when combat starts. Enable() and Disable() gate the device.

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

phase_gated_turret := class(creative_device):

    @editable
    Spawner : vehicle_spawner_df9_device = vehicle_spawner_df9_device{}

    # Buttons to flip the combat phase.
    @editable
    StartCombatButton : button_device = button_device{}

    @editable
    EndCombatButton : button_device = button_device{}

    OnBegin<override>()<suspends>:void =
        # Start with the turret station off during the build phase.
        Spawner.Disable()
        StartCombatButton.InteractedWithEvent.Subscribe(OnStart)
        EndCombatButton.InteractedWithEvent.Subscribe(OnEnd)

    OnStart(Agent : agent) : void =
        # Combat begins: turn the spawner on and build the turret.
        Spawner.Enable()
        Spawner.RespawnVehicle()

    OnEnd(Agent : agent) : void =
        # Combat over: remove the turret and shut the spawner down.
        Spawner.DestroyVehicle()
        Spawner.Disable()

Punish destruction — clean up and rebuild on a timer

Here we use DestroyedEvent plus an explicit DestroyVehicle() / RespawnVehicle() pair to give players a short window before the emplacement returns.

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

respawning_turret := class(creative_device):

    @editable
    Spawner : vehicle_spawner_df9_device = vehicle_spawner_df9_device{}

    OnBegin<override>()<suspends>:void =
        Spawner.DestroyedEvent.Subscribe(OnDestroyed)
        # Build the first turret at round start.
        Spawner.RespawnVehicle()

    OnDestroyed() : void =
        # DestroyedEvent fired — schedule a rebuild after a cooldown.
        spawn { RebuildAfterDelay() }

    RebuildAfterDelay()<suspends> : void =
        Sleep(8.0)
        # Ensure no stale turret lingers, then spawn fresh.
        Spawner.DestroyVehicle()
        Spawner.RespawnVehicle()

Eject and track occupants with AgentExitsVehicleEvent

Use the enter/exit events to keep a count of who is using the emplacement, and force a driver in on entry confirmation.

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

occupancy_turret := class(creative_device):

    @editable
    Spawner : vehicle_spawner_df9_device = vehicle_spawner_df9_device{}

    var Occupied : logic = false

    OnBegin<override>()<suspends>:void =
        Spawner.AgentEntersVehicleEvent.Subscribe(OnEnter)
        Spawner.AgentExitsVehicleEvent.Subscribe(OnExit)
        Spawner.RespawnVehicle()

    OnEnter(Agent : agent) : void =
        set Occupied = true
        # Re-affirm this agent as the driver.
        Spawner.AssignDriver(Agent)
        Print("Turret is now occupied.")

    OnExit(Agent : agent) : void =
        set Occupied = false
        Print("Turret seat is free.")

Gotchas

  • DestroyedEvent and the deprecated VehicleDestroyedEvent / VehicleSpawnedEvent are listenable(tuple()) — their handlers take no parameters. Only SpawnedEvent hands you a payload (fort_vehicle). Writing OnDestroyed(V : fort_vehicle) will not compile against DestroyedEvent.
  • Prefer SpawnedEvent over VehicleSpawnedEvent. The latter is deprecated and carries no vehicle handle; the former gives you the live fort_vehicle so you can call GetFuelRemaining(), GetOccupants(), TeleportTo(...), etc.
  • You must declare the spawner as an @editable field inside a class(creative_device) and bind it in the Details panel. A bare vehicle_spawner_df9_device.RespawnVehicle() fails with Unknown identifier.
  • RespawnVehicle() always destroys the current turret first. Don't call DestroyVehicle() immediately before it expecting two turrets — you'll just spawn one. Use RespawnVehicle() alone when you want a fresh turret.
  • AssignDriver needs an agent, and trigger/button events hand you different shapes. A trigger_device.TriggeredEvent gives ?agent (unwrap with if (P := MaybeAgent?)), while button_device.InteractedWithEvent gives a plain agent. Match the unwrap to the source.
  • message parameters need localized text. If you pass a turret status to a HUD or popup device, build it with a <localizes> helper like Announce<localizes>(S:string):message = "{S}" — there is no StringToMessage.
  • AssignDriver fails silently if there's no turret yet. Spawn (or RespawnVehicle) before assigning, or assign inside the SpawnedEvent / AgentEntersVehicleEvent flow where a vehicle is guaranteed to exist.

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