The Magic Remote: Controlling Devices in Verse
Tutorial beginner

The Magic Remote: Controlling Devices in Verse

Updated beginner

The Magic Remote: Controlling Devices in Verse

Imagine you have a remote control for a toy car. You can make it go fast, slow, or stop. In Fortnite Creative, devices are like those toys. But they don't move on their own. They need instructions.

Verse is the language we use to send those instructions. Today, we will learn how to change a device's settings while the game is running. We will build a "Power-Up Zone." When a player steps in it, they get a speed boost. Let's make it happen!

What You'll Learn

  • What a Device is in Verse.
  • How to find a specific device in your island.
  • How to change a device's settings using code.
  • How to use Events to trigger changes.

How It Works

Think of your island like a big house. Inside the house, there are many rooms. Each room has furniture. In Verse, every object in your island is called an Entity. An Entity is just a fancy word for "something that exists in the game world."

A Device is a special kind of Entity. It is a tool that does something. Examples include:

  • A Fuel Pump (gives you gas).
  • A Skydive Volume (lets you fly).
  • A Tank Spawner (creates tanks).
  • A Rocket Boost Power-Up (makes you fast).

When you place a device in the editor, it has default settings. These are the factory settings. But you can change them! This is called Configuration.

In Verse, we use a special command to find a device. We call this Referencing. It's like pointing your finger at a specific toy and saying, "You, change your color!"

We also use Events. An Event is a moment in time. For example, "When a player enters this volume." We want to link the Event to the Configuration.

  1. Find the device.
  2. Wait for the player to step on it.
  3. Change the device settings.

Let's Build It

We will build a simple zone. When a player steps on a blue rug, they get a Rocket Boost. The boost will be visible and active.

Step 1: Set Up Your Island

  1. Open UEFN and create a new island.
  2. Place a Skydive Volume device in the center of the map.
  3. Make it large enough to stand on.
  4. Place a Rocket Boost Power-Up device nearby. This is the device we will control.

Step 2: The Verse Code

Copy this code into a new Verse file. We will explain it below.

# This is our main script. It runs when the game starts.
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }

# We create a new class. Think of this as a blueprint.
# It holds the data for our power-up zone.
# Attach this device to a Verse Device in the editor.
power_up_zone := class(creative_device):

    # These two variables are set in the editor by dragging
    # devices onto the Verse Device's property panel.
    # SkydiveVolume lets us detect when a player enters the zone.
    @editable
    EntryVolume : skydive_volume_device = skydive_volume_device{}

    # RocketBoostDevice is the power-up we will activate.
    @editable
    PowerUpDevice : health_powerup_device = health_powerup_device{}

    # This function runs when the game starts.
    OnBegin<override>()<suspends> : void =
        # We subscribe to the EntryVolume's AgentEntersEvent.
        # This means: "When a player enters the volume, call OnPlayerEntered."
        EntryVolume.AgentEntersEvent.Subscribe(OnPlayerEntered)

    # This event happens when a player enters the volume.
    # The agent parameter is the player who stepped inside.
    OnPlayerEntered(Agent : agent) : void =
        # Enable the Power-Up device.
        # This turns the power-up on so the player can collect it!
        PowerUpDevice.Enable()
        # note: powerup_device exposes Enable/Disable but not
        # runtime BoostDuration or BoostSpeed fields; set those values
        # in the device's editor property panel before running the game.```

### Walkthrough

Let's break down the code line by line.

**`power_up_zone := class(creative_device):`**
This line creates a **Class**. A class is like a blueprint for our script. By inheriting from `creative_device`, we tell Verse that this script lives on a device we placed in the editor.

**`@editable`**
This is a **Decorator**. It tells UEFN to show the next variable in the editor's property panel. This is how we connect our script to real devices on the island  by dragging and dropping them in the editor, no searching by name required.

**`EntryVolume : skydive_volume_device = skydive_volume_device{}`**
This line creates a **Variable**. A variable is like a box. We named the box `EntryVolume`. We told Verse what kind of box it is: a `skydive_volume_device`. The `skydive_volume_device{}` is the default empty value. We will fill it by assigning a real device in the editor.

**`OnBegin<override>()<suspends> : void =`**
This is a special **Function**. A function is a list of instructions. `OnBegin` means "do this when the game starts." We use `override` because we are replacing the default start behaviour from `creative_device`. The `<suspends>` tag means this function can wait for things to happen over time.

**`EntryVolume.AgentEntersEvent.Subscribe(OnPlayerEntered)`**
This is the most important line. `AgentEntersEvent` is an **Event** built into `skydive_volume_device`. `.Subscribe(OnPlayerEntered)` means "whenever this event fires, run my `OnPlayerEntered` function." It is like setting up a doorbell  every time someone enters, the bell rings.

**`OnPlayerEntered(Agent : agent) : void =`**
This is our **Event Handler** function. Verse calls it automatically each time a player enters the volume. The `Agent` parameter tells us who stepped inside.

**`PowerUpDevice.Enable()`**
This is **Configuration**. We are reaching into the Rocket Boost device and switching it on. `Enable()` is a real method on `rocket_boost_powerup_device` that activates the device so players can collect the boost.

## Try It Yourself

Now it's your turn to experiment!

**Challenge:**
Change the code so that the Rocket Boost gives the player **Shield** instead of just speed.

**Hint:**
Look at the Rocket Boost Power-Up device options in the editor. Is there a setting for "Grant Items" or "Shield"? Try finding that setting name in Verse and setting it to `true`.

**Steps to help:**
1.  Open the Rocket Boost device in the editor.
2.  Look for a setting related to shields or items.
3.  Guess the Verse name for that setting (it's usually similar to the editor name).
4.  Add a line in your `OnPlayerEntered` function to turn it on.

## Recap

*   **Entities** are all the objects in your game.
*   **Devices** are special entities that do actions.
*   **Variables** are boxes that hold references to devices.
*   **Configuration** is changing a device's settings using code.
*   **Events** like `OnPlayerEntered` let us react to player actions.

You just learned how to talk to devices! You can now control Fuel Pumps, Tank Spawners, and more. Keep practicing, and you will build amazing islands soon.

## References

*   https://dev.epicgames.com/documentation/en-us/fortnite/using-fuel-pump-devices-in-fortnite-creative
*   https://dev.epicgames.com/documentation/en-us/fortnite/using-skydive-volume-devices-in-fortnite-creative
*   https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-tank-spawner-devices-in-fortnite-creative
*   https://dev.epicgames.com/documentation/en-us/fortnite/usingrocketboostpowerupdevicesinfortnitecreative
*   https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-class-designer-devices-in-fortnite-creative

Verse source files

Turn this into a guided course

Add Other Device Options 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