The Blueprint of Chaos: Building Your First Verse Script in UEFN
The Blueprint of Chaos: Building Your First Verse Script in UEFN
So, you’ve dropped into Fortnite Creative, built a cool map, and realized that while you can place a trap, you can’t actually make the trap think. That’s where Unreal Editor for Fortnite (UEFN) comes in. Think of UEFN as the difference between playing a board game and writing the rulebook for a new, slightly more chaotic version of it. It’s the professional-grade editor that lets you dig under the hood of Fortnite’s engine.
But here’s the kicker: the real magic happens when you add Verse. Verse is the programming language Epic built specifically for Fortnite islands. It’s not just code; it’s the nervous system of your island. Without it, your island is a static diorama. With it, your island is a living, breathing, revenge-seeking monster.
In this tutorial, we’re going to skip the boring "Hello World" stuff. Instead, we’re going to build a "Revenge Trap." When a player steps on a pressure plate, they don’t just get a notification—they get launched into the stratosphere. We’ll cover the basics of how UEFN talks to Verse, what a "Function" is (it’s easier than it sounds), and how to make your first interactive device.
What You'll Learn
- The Scene Graph: Understanding how your island is organized like a family tree (entities, components, and hierarchy).
- Functions: How to package a specific action (like "launch player") into a reusable button.
- Events: How to listen for player actions (like stepping on a plate) and trigger a response.
- UEFN Integration: How to connect a Creative Device to your Verse script without needing a degree in computer science.
How It Works
Before we write a single line of code, we need to understand the architecture. In Fortnite Creative, you place Devices (like a Pressure Plate or a Prop Mover). In UEFN, everything is an Entity.
Think of an Entity like a specific player in a match. It has a name, a position, and a loadout. In UEFN, an Entity is any object in your world—a tree, a building, a player, or a device.
Now, Entities have Components. If the Entity is the "Player," the Components are their stats: Health, Shield, Ammo. In UEFN, Components are the properties that define what an Entity is and does. A Pressure Plate is an Entity. Its Components include "Is Triggered" and "Radius."
Verse is the script that connects these Components to gameplay logic. It’s like the referee in a match. The referee doesn’t play the game, but they watch the players (Entities) and blow the whistle (trigger Events) when a rule is broken.
The "Function" Analogy
In programming, a Function is a block of code that performs a specific task. Think of it like a Loadout. You don’t just carry your items randomly; you organize them into slots (Primary, Secondary, Melee). When you need to shoot, you switch to the Primary slot. A Function is that slot. You define what happens inside it (e.g., "Apply Damage"), and when you "call" the function, it executes.
The "Event" Analogy
An Event is something that happens in the game world that your code needs to react to. In Fortnite, this is like the Storm closing. The storm doesn’t care if you’re ready; it just closes. Your code needs to "listen" for the storm timer reaching zero, then react by dealing damage. In Verse, we write code that "listens" for player actions (like stepping on a plate) and then runs our Functions.
Let's Build It
We’re going to create a simple Verse script that launches a player when they step on a plate. We’ll use the Prop Mover device as the "muscle" that does the launching, and Verse as the "brain" that tells it when to move.
Step 1: Set Up the Device
- Open UEFN and create a new project (or open an existing one).
- Go to the Devices tab and place a Pressure Plate in your world.
- Place a Prop Mover nearby. Set its Target to a point high in the air (where you want the player to go).
- Set the Prop Mover’s Activation Mode to "Manual" (we’ll control it with code, not the plate directly).
- Name your Prop Mover
LaunchPad. (This is important—Verse needs to find it by name).
Step 2: Create the Verse Script
- In the Content tab, right-click and create a new Verse File. Name it
RevengeTrap.verse. - Open the file. You’ll see a blank canvas.
Here is the code. Don’t panic—each line has a comment explaining what it does.
# This is a Verse script for a Revenge Trap.
# It launches a player when they step on a pressure plate.
# 1. Define the Function: "LaunchPlayer"
# Think of this as defining the "Launch" loadout slot.
# It takes no inputs (empty parentheses) and returns nothing (void).
LaunchPlayer := function () {
# Find the Prop Mover device by its name in the world.
# If it doesn't exist, this will fail, so make sure you named it correctly!
pad := World.FindDeviceByName ("LaunchPad")
# Check if the device actually exists.
# This is like checking if your gun has ammo before shooting.
if (pad != nil) {
# "Activate" the Prop Mover.
# This tells the device to start moving its target.
pad.Activate ()
# Optional: Wait 2 seconds, then reset it.
# This is like the cooldown on a special ability.
World.SetTimer (2.0, func () {
pad.Deactivate ()
})
}
}
# 2. Define the Event: "OnPlayerBeginOverlap"
# This is the referee listening for a rule break.
# It listens for any player stepping on the Pressure Plate.
OnPlayerBeginOverlap := function (event : Event < (Player : Player) >) {
# When a player steps on the plate, call the LaunchPlayer function.
# This is like blowing the whistle and making the referee act.
LaunchPlayer ()
}
# 3. Connect the Event to the Device
# We need to tell the Pressure Plate to listen for overlaps.
# In UEFN, you usually do this in the device's properties,
# but in Verse, we can attach the event handler to the world.
# Note: For simplicity in this beginner tutorial,
# we assume the Pressure Plate is set to trigger "OnBeginOverlap"
# in its own properties, and we hook into that global event.
# To make this work, we need to register the event handler.
# This is like telling the referee, "Watch this specific player."
World.OnPlayerBeginOverlap += OnPlayerBeginOverlap
Walkthrough: What Just Happened?
LaunchPlayer := function () { ... }: We defined a function calledLaunchPlayer. Inside the curly braces{ }is the code that runs when we call this function. It finds the device namedLaunchPadand activates it.World.FindDeviceByName ("LaunchPad"): This is how Verse talks to the UEFN world. It searches for an Entity with the name "LaunchPad." If it finds it, it returns the device. If not, it returnsnil(which is like having an empty inventory slot).if (pad != nil): This is a Conditional Statement. It’s like checking if the storm is active. Ifpadis notnil(i.e., the device exists), we run the code inside. If it isnil, we skip it. This prevents crashes.pad.Activate (): This is the actual action. It tells the Prop Mover to start moving.OnPlayerBeginOverlap := function (event : Event < (Player : Player) >) { ... }: This function listens for the event of a player beginning to overlap with a trigger. Theeventparameter contains data about what happened (like which player triggered it).World.OnPlayerBeginOverlap += OnPlayerBeginOverlap: This line connects our listening function to the game world. It’s like plugging a microphone into a sound system. Now, whenever a player steps on any trigger, our function runs.
Important Note: In this simple example, the Pressure Plate in the editor must be set to trigger OnBeginOverlap. Verse is the brain, but the Plate is the ear. You need to make sure the Plate is actually "hearing" the player. In a more advanced script, you’d pass the specific Plate to the Verse script, but for beginners, using the global event is a great starting point.
Try It Yourself
You’ve built a basic launch pad. Now, let’s make it more fun.
Challenge: Modify the LaunchPlayer function so that it doesn’t just launch the player, but also changes the color of the Prop Mover to bright red when it activates, and back to blue when it deactivates.
Hint: Look up the SetMaterial or SetColor function for devices in the Verse documentation. You’ll need to find the Prop Mover again, then apply a material or color change. Think of it like changing your team color before a match.
Recap
- UEFN is the professional editor that gives you deep access to Fortnite’s engine.
- Verse is the programming language that makes your island interactive.
- Functions are reusable blocks of code (like loadouts) that perform specific tasks.
- Events are triggers that listen for gameplay actions (like the storm closing) and run your code.
- The Scene Graph is the hierarchy of Entities and Components that make up your world.
You’ve just taken your first step from playing Fortnite to programming it. The launch pad is just the beginning. Next time, we’ll add explosions, scores, and maybe a little bit of chaos.
References
- https://dev.epicgames.com/documentation/en-us/fortnite/modeling-in-unreal-editor-for-fortnite
- https://dev.epicgames.com/documentation/en-us/fortnite/build-a-game-in-unreal-editor-for-fortnite
- https://dev.epicgames.com/documentation/en-us/fortnite/user-interface-reference-for-unreal-editor-for-fortnite
- https://dev.epicgames.com/documentation/en-us/uefn/unreal-editor-for-fortnite-documentation
- https://dev.epicgames.com/documentation/en-us/fortnite/fortnite-glossary
Verse source files
- 01-fragment.verse · fragment
Turn this into a guided course
Add From 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.
References
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.