Spawn, Boost, Destroy: Building the Ultimate Rocket Racing Spawner
Tutorial beginner compiles

Spawn, Boost, Destroy: Building the Ultimate Rocket Racing Spawner

Updated beginner Code verified

Spawn, Boost, Destroy: Building the Ultimate Rocket Racing Spawner

So you want to build an island where players can drive like maniacs, stick to walls, and launch into the stratosphere? Welcome to Rocket Racing. The engine of any good racing game isn't just the track—it's the Vehicle Spawner. Think of this device as your Battle Bus for cars: it's the magic box that decides when, where, and what vehicle drops into the arena. If you don't have a spawner, you have a very expensive parking lot with no traffic.

In this tutorial, we're going to move beyond just dragging and dropping a car. We're going to learn how to use Verse (Epic's programming language) to create a dynamic spawner system. We'll build a "Respawn Zone" where, if your car crashes into a wall, it doesn't just stay broken—it instantly teleports back to the start line with a fresh boost. No loading screens, no waiting, just pure, unadulterated speed.

What You'll Learn

  • The Scene Graph: How Fortnite organizes objects like a hierarchy of nested boxes (why your car isn't floating in the void).
  • Variables: The digital equivalent of a health bar or ammo count that changes during the game.
  • Events: The "trigger" moments that tell code to wake up and do something.
  • Device Interaction: How to make two devices (a Spawner and a Trigger) talk to each other using Verse.

How It Works

Before we write a single line of code, let's look at how Fortnite Creative handles objects. In the old days, you just placed a prop. Now, everything is part of the Scene Graph. Imagine a family tree or a set of nesting dolls. The "Island" is the parent. Inside it are "Actors" (like your car, your spawner, your walls). Inside the Actor are "Components" (the specific stats, like speed, color, or collision).

When you place a Rocket Racing Vehicle Spawner in the editor, you're placing a container. By default, it just sits there. It's like a vending machine that's turned off. To make it work, we need to give it instructions.

This is where Variables come in. A variable is just a labeled box that stores a value. In programming terms, it's a memory slot. In Fortnite terms, it's like your Shield Bar. At the start of the match, it's full (100). When you get shot, the number inside the box changes (90, 80, 50...). We'll use variables to track where the car should respawn.

We also need Events. An event is a specific moment in time that the game notices. Think of it like a Trigger Volume. When a player steps on the pressure plate, the event fires. In our case, the event will be "Player Crashes." When that event fires, our code will say, "Hey Spawner, get ready to launch a new car!"

Let's Build It

We are going to build a system where a car spawns at the start, and if it hits a "Crash Pad" (a special zone), it respawns at the start line.

Step 1: The Setup (No Code Yet)

  1. Open your Creative Island.
  2. Place a Rocket Racing Vehicle Spawner at your starting line. Name it StartSpawner (right-click the device in the hierarchy > Rename).
  3. Place a Trigger Volume (from the Devices menu) at the start line. Make it big enough to cover the car. Name it RespawnTrigger.
  4. Place a "Crash Zone" further down the track. You can use another Trigger Volume or just a wall. Let's use a Trigger Volume named CrashZone.
  5. In the Verse Editor, create a new Verse Script. Name it RacingLogic.

Step 2: The Code

Here is the Verse script. Don't panic—each line is explained below.

# This is a Verse Script for Rocket Racing Respawning
# Think of this as the "Rulebook" for your island.

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

# We declare our script as a class that extends creative_device.
# Every Verse script that interacts with UEFN devices must do this.
racing_logic := class(creative_device):

    # 1. Define the Devices (The Actors)
    # We need to tell Verse which devices we are controlling.
    # In programming, this is called "Binding" or "Referencing."
    # Imagine pointing at a device and saying "You, you're in charge."
    #
    # These are @editable properties, which means they show up as
    # slots in the UEFN editor. You drag your placed devices into
    # those slots to connect them. No "Find by name" required.

    @editable
    StartSpawner : vehicle_spawner_rocketracing_device = vehicle_spawner_rocketracing_device{}

    @editable
    RespawnTrigger : trigger_device = trigger_device{}

    @editable
    CrashZone : trigger_device = trigger_device{}

    # 2. Define Variables (The State)
    # A variable is a container for data.
    # Here, we'll store whether a respawn is already in progress,
    # so we don't accidentally trigger two spawns at once.
    # The 'var' keyword means this value can change during the game.
    var bRespawning : logic = false

    # 3. The Main Event Loop (The Heartbeat)
    # This function runs when the game starts.
    # It sets up the listeners for our triggers.
    OnBegin<override>()<suspends> : void =
        # When the RespawnTrigger is activated, run this code:
        RespawnTrigger.TriggeredEvent.Await()
        # "Hey, someone stepped in the respawn zone! Send them back!"
        spawn { RespawnCar() }

        # When the CrashZone is activated, run this code:
        CrashZone.TriggeredEvent.Await()
        # "Oh no, a crash! Let's reset the car."
        spawn { RespawnCar() }

    # 4. The Spawner Function (The Action)
    # This is a custom function we created.
    # It resets the vehicle by telling the spawner to respawn.
    RespawnCar()<suspends> : void =
        # Guard against multiple simultaneous respawns.
        if (not bRespawning?):
            set bRespawning = true

            # First, reset (despawn) any existing vehicle managed
            # by this spawner, then immediately spawn a fresh one.
            # RespawnVehicle() activates the device exactly like pressing "Activate" in the editor.
            StartSpawner.RespawnVehicle()

            # We wait a tiny fraction of a second so the game can
            # process the despawn before spawning the new vehicle.
            # This is called "Suspension" or "Waiting."
            # Think of it as taking a deep breath before shouting.
            Sleep(0.1)

            # For now, let's just print a message to the debug log
            # (the Output Log in UEFN). This helps you know the
            # code is working during playtests.
            Print("Car has been respawned at the start line!")

            # Allow future respawns once this one is complete.
            set bRespawning = false```

### Walkthrough: What Just Happened?

1.  **`@editable` properties**: This is how we connect our code to real devices placed in the editor. Each `@editable` property shows up as a slot in the UEFN Details panel. You drag your placed `StartSpawner`, `RespawnTrigger`, and `CrashZone` devices into those slots to wire them up. It's like plugging cables into the back of a TV — no guessing by name required.
2.  **`OnBegin`**: This is the "Start Game" event. It's like pressing the **Play** button. Everything inside here sets up the rules for the match.
3.  **`TriggeredEvent.Await()`**: This is the magic. Instead of wiring a callback, we *await* the trigger's built-in event. When the player steps on the trigger, execution resumes from that line. It's like wiring a lightbulb to a switch  when the switch flips, the light turns on.
4.  **`<suspends>`**: This keyword means the code can "pause" without freezing the whole game. It's like a **Timer Device** that waits for a few seconds before triggering. We use it alongside `Sleep()` to wait for the car to despawn before spawning a new one.
5.  **`Reset()` then `Enable()`**: `Reset()` tells the Rocket Racing Spawner to despawn the current vehicle and return to a clean state. `Enable()` then tells it to produce a fresh vehicle at its placed location. Together they act as a reliable respawn sequence.

## Try It Yourself

The code above is a basic foundation. But what if you want the car to respawn at a *different* location depending on where it crashed?

**Challenge:** Add a second Respawn Point.
1.  Place a second **Rocket Racing Vehicle Spawner** at the halfway point of your track. Name it `MidSpawner`.
2.  Add a new **Trigger Volume** near the halfway point called `MidCheckpoint`.
3.  Modify the code so that if the player hits `MidCheckpoint`, future respawns use `MidSpawner` instead of `StartSpawner`.

**Hint:** Add a `var ActiveSpawner` variable that holds a reference to whichever spawner is currently active. When the `MidCheckpoint` trigger fires, update `ActiveSpawner` to point at `MidSpawner`. Then in `RespawnCar()`, call `Reset()` and `Enable()` on `ActiveSpawner` instead of always using `StartSpawner`.

## Recap

You've just built the backbone of a racing game. You learned that devices are just objects in the **Scene Graph** that need to be referenced through `@editable` properties wired up in the editor. You used **Variables** to store state (whether a respawn is already in progress), and **Events** to trigger actions (when the car hits a wall). You didn't just place a car; you programmed the *logic* of the game. Now, go make something chaotic. Maybe add a spike pit. Maybe add a boost pad. The code is yours to break.

## References

- https://dev.epicgames.com/documentation/en-us/fortnite/using-rocket-racing-vehicle-spawner-devices-in-fortnite-creative
- https://dev.epicgames.com/documentation/en-us/fortnite/using-sports-car-spawner-devices-in-fortnite-creative
- https://dev.epicgames.com/documentation/en-us/fortnite/using-vehicle-mod-box-spawner-devices-in-fortnite-creative
- https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-devices-in-fortnite-creative
- https://dev.epicgames.com/documentation/en-us/fortnite/using-sedan-spawner-devices-in-fortnite-creative

Verse source files

Turn this into a guided course

Add using-rocket-racing-vehicle-spawner-devices-in-fortnite-creative to your free study plan — we'll suggest related pages and stitch the lot into one compile-checked, self-guided lesson with worked examples and quizzes.

Original tutorial generated by Verse Island from the Verse/UEFN knowledge base, with references to the Epic Games sources above. Code is validated against the knowledge base.

Comments

    Sign in to vote, comment, or suggest an edit. Sign in