How to Build a UFO Racing Island with Verse
Tutorial beginner compiles

How to Build a UFO Racing Island with Verse

Updated beginner Code verified

How to Build a UFO Racing Island with Verse

Do you want to race flying saucers? You can! We will build a simple racing game. You will spawn a UFO. You will drive it around. It is super fun. Let's make your own space race.

What You'll Learn

  • How to place a UFO Spawner device.
  • How to use a Trigger to start the game.
  • How to drive the UFO.
  • The basics of Scene Graph (how devices talk to each other).

How It Works

Imagine your island is a toy box. Inside are many toys. Each toy is an Entity. A UFO is one entity. A trigger is another entity. They do not talk until you connect them.

In programming, we call this the Scene Graph. Think of it like a family tree. The island is the parent. The UFO and the trigger are children. We give them names. Then we tell them what to do.

Here is our plan:

  1. We place a UFO Spawner. It holds a UFO.
  2. We place a Trigger. It is like an invisible mat.
  3. We write a tiny script. It says: "When someone steps on the mat, spawn the UFO."
  4. Players step on the mat. The UFO appears! They drive it.

This is better than just placing a UFO. Why? Because you can hide it first. You can make it appear only when ready. This is called Spawning. Spawning means creating something in the game world.

Let's Build It

First, open Fortnite Creative. Press Tab. Open the Devices tab. Search for "UFO Spawner". Drag it onto your island. Place it where you want the UFO to appear.

Now, search for a "Trigger". Place it near the spawner. This is your start button.

Now, we need code. We will use Verse. Verse is the language for Fortnite islands. It tells devices what to do.

Copy this code into a new Verse file. Name it UfoRace.

# This is our main script.
# It connects the trigger to the spawner.

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

# We create a "Device Table".
# Think of this as a list of devices we control.
# We give them simple names.
ufo_race_manager := class(creative_device):

    # The trigger that starts the game
    @editable
    StartTrigger : trigger_device = trigger_device{}

    # The spawner that creates the UFO
    # note: vehicle_spawner_ufo_device is the real Verse type for the UFO Spawner device.
    @editable
    UfoSpawner : vehicle_spawner_ufo_device = vehicle_spawner_ufo_device{}

    # OnBegin runs automatically when the game starts.
    # This is where we wire up our event listeners.
    OnBegin<override>()<suspends> : void =

        # This is an "Event".
        # An event is a signal. It says "Hey! Something happened!"
        # Here, we listen for when the trigger is pressed.
        StartTrigger.TriggeredEvent.Subscribe(OnStartTriggered)

    # This function runs when the trigger fires.
    # agent? means the triggering agent (player) may or may not exist.
    OnStartTriggered(Agent : ?agent) : void =
        # When triggered, we call our function.
        SpawnTheUfo()

    # This is a "Function".
    # A function is a recipe. It is a set of steps.
    # We name it SpawnTheUfo.
    SpawnTheUfo() : void =
        # This line tells the spawner to make a UFO.
        # It uses the "Enable" action, which respawns the vehicle.
        # note: vehicle_spawner_ufo_device exposes Enable() to activate/respawn the UFO.
        UfoSpawner.Enable()

        # Optional: Print a message to the console.
        # This helps you debug.
        Print("UFO Spawned! Go drive!")```

### Walkthrough

Let's look at the code. It has three parts.

**1. The Device Table**
We list our devices. We call them `StartTrigger` and `UfoSpawner`. This is like labeling your toys. Now Verse knows which toy is which.

**2. The Event**
We use `TriggeredEvent.Subscribe`. This is like tying a string. The string connects the trigger to our code. When the trigger is pressed, the string pulls. Our code runs.

**3. The Function**
`SpawnTheUfo` is our recipe. Inside, we call `UfoSpawner.Enable()`. This is the magic word. It tells the spawner to create the vehicle.

Place this Verse file in your island folder. Link the devices in the editor. Select the UFO Spawner device. In the details panel, look for "Verse Device". Select your script. Link `StartTrigger` to your trigger device. Link `UfoSpawner` to your spawner device.

Now, play the game. Run to the trigger. Step on it. Watch the UFO appear!

## Try It Yourself

You made a UFO appear! Now, let's make it harder.

**Challenge:**
Make the UFO disappear after 5 seconds.

**Hint:**
You can use a **Timer Device**. Or, you can use Verse to wait. Look for a "Wait" function in Verse. It pauses the code for a few seconds. Then, you can tell the UFO to despawn.

## Recap

*   **Entities** are objects in your game.
*   The **Scene Graph** is how they connect.
*   **Devices** like triggers and spawners work together.
*   **Verse** is the language that connects them.
*   You built a working UFO race start!

Great job! You made something real. You can play it now. Keep building. Keep coding. You are a creator!

## References

*   https://dev.epicgames.com/documentation/en-us/fortnite/using-ufo-spawner-devices-in-fortnite-creative
*   https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-ufo-spawner-devices-in-fortnite-creative
*   https://dev.epicgames.com/documentation/en-us/fortnite/using-devices-in-fortnite
*   https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-devices-in-fortnite-creative
*   https://dev.epicgames.com/documentation/en-us/fortnite/using-helicopter-spawner-devices-in-fortnite-creative

Verse source files

Turn this into a guided course

Add using-ufo-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