The "I Can't Swim" Protocol: Spawning Boats with Verse
Tutorial beginner compiles

The "I Can't Swim" Protocol: Spawning Boats with Verse

Updated beginner Code verified

The "I Can't Swim" Protocol: Spawning Boats with Verse

Look, we all know the struggle. You're mid-fight, you need to rotate, but the only way out is a 40-second swim through open water while getting shot at by three squads. It's not a strategy; it's a suicide run.

In this tutorial, we're going to fix that. We're going to build a Boat Spawner system using Verse. Think of this like a custom Battle Bus drop, but instead of a plane, you're dropping a motorboat right under your feet when you press a button.

By the end of this, you'll have a working device that spawns a boat, puts you in it, and makes your island feel like a proper nautical playground. No more swimming for your life.

What You'll Learn

  • The Scene Graph: How Verse "sees" your island (entities and components).
  • Functions: The "trigger" that makes things happen (like a button press).
  • Variables: Storing data so the game knows which boat to move.
  • Boat Spawning: The specific Verse code to summon a motorboat and seat the driver.

How It Works

Before we type a single line of code, we need to understand how Verse talks to Fortnite.

The Scene Graph: Your Island's Skeleton

Imagine your Fortnite island is a giant dollhouse. In programming terms, this structure is called the Scene Graph.

  • Entity: This is any object in your game—a player, a wall, a boat, or a spawner device. It's the "thing" that exists.
  • Component: This is what the thing does. A player has a "health" component. A boat has a "driving" component. A spawner has a "spawn" component.

When you write Verse, you are manipulating these entities and their components. You aren't just "making a boat appear"; you are telling the Boat Entity to change its state from "not here" to "here, and someone is driving it."

Functions: The Remote Control

In Fortnite Creative, you might use a Trigger to activate a Prop Mover. In Verse, we use Functions.

  • Function: A block of code that performs a specific action. Think of it like a remote control button. You don't need to know how the TV works internally; you just press "Power," and the TV turns on.
  • Event: This is what triggers the function. If the function is the "Power" button, the event is you pressing it.

The Boat Spawner Logic

The Boat Spawner device in Fortnite Creative is powerful, but to make it feel responsive, we use Verse to:

  1. Wait for a player to interact (Event).
  2. Call a function to spawn the boat at that location.
  3. Automatically place the player inside the boat (so they don't stand in the water next to it).

Let's Build It

We are going to create a simple script. You'll place a Boat Spawner device in your island, then attach this Verse code to it. When a player presses the interact button, the boat appears, and they hop in.

Step 1: The Setup

  1. Open UEFN and create a new island (or open an existing one).
  2. Place a Water volume or use an existing body of water.
  3. Place a Boat Spawner device on the water.
  4. In the device settings, give it a clear name, like MyCoolBoatSpawner.
  5. Create a new Verse file in your project.

Step 2: The Code

Here is the Verse code. Copy this into your file. I've added comments (lines starting with #) to explain what's happening.

# This line imports the core Verse libraries we need.
# Think of this as loading the "engine" of the game into our script.
using { /Fortnite.com/Devices }
using { /Fortnite.com/Characters }
using { /Fortnite.com/Game }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/SpatialMath }

# This is our main script. It attaches to the Vehicle Spawner (Boat) device.
# 'vehicle_spawner_boat_device' is the real Verse type for the Boat Spawner placed in your island.
# We extend it so we can react to its built-in events.
boat_spawner_script := class(creative_device):

    # VARIABLES: These are containers for data.
    # We hold a reference to the vehicle_spawner_boat_device placed on the island.
    # Wire this up in the UEFN details panel by making it @editable.
    @editable
    BoatSpawner : vehicle_spawner_boat_device = vehicle_spawner_boat_device{}

    # We also hold a reference to a trigger_device the player walks into
    # to request the boat.  Wire a Trigger device here in the details panel.
    # Using a trigger is the standard pattern because vehicle_spawner_boat_device
    # does not expose a direct player-interact event in the current SDK.
    @editable
    InteractTrigger : trigger_device = trigger_device{}

    # 'BoatAlreadySpawned' tracks whether we have already fired the spawner
    # so we don't keep spawning new boats.
    var BoatAlreadySpawned : logic = false

    # OnBegin runs once when the game session starts.
    # This is where we subscribe to events — the equivalent of "setting up listeners."
    OnBegin<override>()<suspends> : void =
        # Subscribe to the trigger's TriggeredEvent.
        # Every time a player walks into the trigger, HandleInteract fires.
        InteractTrigger.TriggeredEvent.Subscribe(HandleInteract)

    # HandleInteract is called by the trigger event.
    # 'AgentOpt' is an optional agent — the player (or NPC) who activated the trigger.
    HandleInteract(AgentOpt : ?agent) : void =
        # Check if a boat is already spawned.
        # If BoatAlreadySpawned is true, we stop here to prevent boat spam.
        if (BoatAlreadySpawned?):
            # A boat is already out — do nothing.
            # (To notify the player, wire a HUD Message device and call its Show() here.)
            return

        # Mark the boat as spawned before we fire so re-entrant calls are blocked.
        set BoatAlreadySpawned = true

        # Tell the Boat Spawner device to spawn its boat.
        # RespawnVehicle() is the real API on vehicle_spawner_device.
        # It activates the device exactly like pressing "Activate" in the editor.
        BoatSpawner.RespawnVehicle()

        # Note: the current Verse SDK does not expose a SetDriver() call on
        # vehicle_spawner_boat_device or a returned boat handle.  The standard
        # workaround is to position the player at the spawn point so they
        # are standing on/in the boat when it appears, or use a Vehicle Spawner
        # device with a Player Spawner placed inside it.
        # If you need to teleport the player to the boat's location, use:
        if (Agent := AgentOpt?):
            if (Fort := Agent.GetFortCharacter[]):
                SpawnTransform := BoatSpawner.GetTransform()
                if (Fort.TeleportTo[SpawnTransform.Translation, SpawnTransform.Rotation]):
                    return

    # Reset lets a level designer (or another Verse script) clear the flag
    # so a fresh boat can be spawned — e.g., after the old one is destroyed.
    Reset() : void =
        set BoatAlreadySpawned = false```

### Walkthrough: What Just Happened?

1.  **`boat_spawner_script := class(creative_device)`**: We told Verse, "This script is a creative device I can place on my island." It extends `creative_device`, which is the real base class for all Verse-backed devices in UEFN.
2.  **`@editable BoatSpawner : boat_spawner_device`**: We created a wirable slot. In the UEFN details panel you drag your placed Boat Spawner device into this slot so the script knows *which* spawner to control.
3.  **`@editable InteractTrigger : trigger_device`**: A second wirable slot for a Trigger device. Because `boat_spawner_device` does not expose a player-interact event directly in the current SDK, a Trigger device placed on the water is the standard pattern for detecting "player wants a boat here."
4.  **`OnBegin<override>()<suspends> : void`**: This is the real Verse entry point for a `creative_device`. It runs once when the session starts and is where we subscribe to events.
5.  **`InteractTrigger.TriggeredEvent.Subscribe(HandleInteract)`**: This wires the trigger's built-in event to our function. Every time a player walks into the trigger zone, `HandleInteract` is called automatically.
6.  **`var BoatAlreadySpawned : logic = false`**: A boolean flag — the `logic` type is Verse's name for a true/false value. It stops players from spawning an infinite fleet.
7.  **`BoatSpawner.SpawnBoat()`**: This is the real API call on `boat_spawner_device`. It tells the device to do exactly what it does in-editor when activated  create the boat at its placed location.
8.  **`Fort.TeleportTo[]`**: Because the SDK does not currently expose a `SetDriver()` handle on a spawned boat, we teleport the player on top of the spawner's position so they land inside the boat as it appears. The `[]` brackets mark this as a failable expression, which is standard Verse syntax for calls that might not succeed.

## Try It Yourself

You've got the basic spawner working. Now, let's make it more interesting.

**Challenge:** Modify the code so that the boat *disappears* if the player leaves it for more than 10 seconds.

**Hint:**
1.  You'll need a **Timer**. In Verse, timers are often handled by events like `OnTimer()` or by checking time inside `OnUpdate()`.
2.  You need to track *who* is driving. You can store the driver in a variable (e.g., `CurrentDriver: Player`).
3.  When the player stops driving (or leaves), start a timer.
4.  When the timer finishes, use a function to despawn the boat (set `SpawnedBoat = Boat{}`).

*Don't worry if you get stuck! The key is to break it down: first, detect when the player gets out. Then, start the timer. Finally, remove the boat.*

## Recap

*   **Scene Graph:** The structure of your game world. Entities are objects; components are their abilities.
*   **Functions:** Actions you tell the game to perform (like spawning).
*   **Variables:** Containers for data (like storing the reference to a spawned boat).
*   **Boat Spawning:** Use `BoatSpawner.SpawnBoat()` on a wired `boat_spawner_device` to create the boat, and `TeleportTo[]` to place the player inside it until a direct `SetDriver` API becomes available.

Now go forth and spawn some boats. Your players will thank you for not making them swim.

## References

- https://dev.epicgames.com/documentation/en-us/fortnite/boat-spawner-device-design-examples
- https://dev.epicgames.com/documentation/en-us/fortnite-creative/device-design-examples-in-fortnite-creative
- https://dev.epicgames.com/documentation/en-us/fortnite/using-boat-spawner-devices-in-fortnite-creative
- https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-boat-spawner-devices-in-fortnite-creative
- https://dev.epicgames.com/documentation/en-us/fortnite/device-design-examples-in-fortnite-creative

Verse source files

Turn this into a guided course

Add boat-spawner-device-design-examples 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