Build Your First Custom Device in Fortnite
Tutorial beginner compiles

Build Your First Custom Device in Fortnite

Updated beginner Code verified

Build Your First Custom Device in Fortnite

Have you ever wished for a button that does something special? Maybe a switch that opens a secret door or a box that gives you a rare item? In Fortnite, these are called "devices." But what if you want to make a device that doesn't exist yet? You can build it yourself!

In this tutorial, you will learn how to create a Verse Device. This is a special tool you build with code. It will let you control game objects in a new way. By the end, you will have a working device in your island editor. You can place it down and use it right away. Let's get started!

What You'll Learn

  • How to open the Verse Explorer in the editor.
  • How to create a new Verse Device file.
  • The difference between a script and a device.
  • How to place your new creation in your game world.

How It Works

Think of your Fortnite island like a big toy box. Inside, you have Lego bricks. Some bricks are pre-made. These are the standard devices you drag and drop. They already have rules inside them.

A Verse Device is like a blank Lego brick. It has no rules yet. You get to write the rules inside it. You use Verse (the coding language) to tell the brick what to do.

First, you write the code in a file. This file is your script. It is like a recipe book. It tells the game how to act. Then, you turn that script into a device. Now, it becomes a real object. You can place it on your island. It sits there until you play the game. Then, it wakes up and follows your recipe.

We will make a simple device. It will just show a message when you click it. This proves your device works. We will use a function. A function is a set of instructions. It is like a magic spell. You say the spell, and something happens.

Let's Build It

Follow these steps carefully. We will create your first custom device.

Step 1: Open Verse Explorer

  1. Open your Fortnite island in the editor.
  2. Look at the top menu bar. Click on Verse.
  3. Select Verse Explorer. A new window will pop up.

Step 2: Create a New Device

  1. In the Verse Explorer window, look for your project name.
  2. Right-click on your project name.
  3. Choose Add new Verse file to project.
  4. A window will ask for a name. Type MyFirstDevice.
  5. Click Create.

You now have a blank script. It is ready for code.

Step 3: Write the Code

Copy this code into your MyFirstDevice.verse file. Do not worry if it looks strange. We will explain it line by line.

# This is a comment. It is for humans only.
# The computer ignores it.

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

# This line creates a new device.
# It is like building the physical box.
MyFirstDevice := class(creative_device):

    # OnBegin runs automatically when the game session starts.
    # It is a built-in event for every creative_device.
    OnBegin<override>()<suspends> : void =
        
        # This line sends a message to the output log.
        # It is like saying "Hello!"
        Print("You activated my custom device!")

Step 4: What Each Part Does

Let's look at the code again. We will break it down.

  • using { /Fortnite.com/Devices }: This line imports the devices module. It gives your code access to creative_device and other tools.
  • MyFirstDevice := class(creative_device): This line names your device. You can call it anything. It tells the editor, "I am making a new object." The : class(creative_device) part tells the code what kind of device it is. It is a basic creative device that the editor can place in your world.
  • OnBegin<override>()<suspends> : void: This is a special event. An event is something that happens in the game. Here, the event is the game session starting. The code inside this function will run automatically at the start of every session.
  • Print(...): This function sends text to the output log. You can see it in the editor's log window while testing your island.

Step 5: Place It in Your World

  1. Save your Verse file. Press Ctrl + S or click File > Save.
  2. Close the Verse Editor if you want.
  3. Look at your device palette in the editor.
  4. You should see a new device named MyFirstDevice.
  5. Drag it into your island. Place it on the ground.
  6. Play your island. Watch the output log when the session starts.

Did you see the message? You did it! You built a device from scratch.

Try It Yourself

You made a device that prints a message. Now, let's make it do more.

Challenge: Change the code so it prints a different message. Maybe say "Nice job!" or "You found a secret!"

Hint: Look at the Print line. Change the words inside the quotes. Remember to save your file after you change it. Then play your island again to see the new message.

Recap

You just created your first Verse device. You opened the Verse Explorer. You wrote a simple script. You placed the device in your world. You tested it by clicking it. This is the start of your coding journey. You can make devices that open doors, spawn items, or change colors. Keep practicing. You are doing great!

References

  • https://dev.epicgames.com/documentation/en-us/uefn/devices-in-unreal-editor-for-fortnite
  • https://dev.epicgames.com/documentation/en-us/fortnite/create-your-own-device-using-verse-in-unreal-editor-for-fortnite
  • https://dev.epicgames.com/documentation/en-us/fortnite/create-your-own-device-in-verse
  • https://dev.epicgames.com/documentation/en-us/uefn/learn-programming-with-verse-in-unreal-editor-for-fortnite
  • https://dev.epicgames.com/documentation/en-us/fortnite/programming-with-verse-in-unreal-editor-for-fortnite

Verse source files

Turn this into a guided course

Add create-your-own-device-using-verse-in-unreal-editor-for-fortnite 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