Day Three: Your First Verse Script (For People Who Have Never Coded)

The first Verse script is the hardest one

Once you have written one Verse script and watched it run inside a real Fortnite session, the rest of Verse stops feeling intimidating. The hardest part is the first one. So this post is dedicated entirely to writing one small, complete, useful Verse script, with every line explained.

If you have not done Day One and Day Two yet, do those first. They give you the editor literacy and the (options, events, functions) mental model you will lean on throughout this post.

What we are going to build today is a timed reward device. Every thirty seconds, it grants every player on the island one unit of a chosen item. It is the kind of device you find in a hub island where players want a slow trickle of resources. More importantly, it touches almost every Verse fundamental: subscriptions, timers, classes, options, and the device system.

Step 1. Make a Verse module

Open your project in UEFN. In the top menu bar, go to Verse > Verse Explorer. The Verse Explorer is the panel where you create and manage Verse code.

In Verse Explorer, find your project's Verse folder. Right-click it and choose Create new Verse File. Name it timed_reward. Open it. UEFN will pop up a Visual Studio Code window with the file already loaded. (If you do not have VS Code installed, the Verse Explorer will prompt you to install it the first time.)

You will see something like this template, give or take a few lines:

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

Those using lines are imports. They make Epic-provided types and functions available to your code. The first one gives you device-related types. The second gives you general simulation primitives like timers. The third is for math; we will not use it today, but we will leave it.

Step 2. Write the device class

Beneath the imports, write this:

timed_reward := class(creative_device):
@editable
ItemGranter : item_granter_device = item_granter_device{}

@editable
IntervalSeconds : float = 30.0

OnBegin<override>()<suspends> : void =
loop:
Sleep(IntervalSeconds)
ItemGranter.GrantItem()

That is the entire script. Let's read it line by line, because every line teaches something important.

timed_reward := class(creative_device): declares a new class called timed_reward that extends creative_device. Anything that extends creative_device can be placed in your level like a normal device. This is the bridge from "Verse code" to "thing in the world." See creative_device in the glossary for the broader picture.

@editable is a decoration that says "expose the next field in the editor's Details panel." Without @editable, a field is invisible to the editor and you can only set it from code.

ItemGranter : item_granter_device = item_granter_device{} declares a field of type item_granter_device and gives it a default of an empty placeholder. Because it is @editable, you will be able to drag any item granter device from your level into this slot in the Details panel. That is how you tell our timed reward which item granter to use.

IntervalSeconds : float = 30.0 declares another @editable field, this time a floating-point number defaulting to thirty. You can change it to fifteen or sixty in the editor without touching code.

OnBegin<override>()<suspends> : void = declares the lifecycle method that runs when the device starts. <override> says "we are overriding the parent class's OnBegin." <suspends> is a Verse effect specifier that means "this function can pause execution." Anything that calls Sleep or waits on an event needs <suspends>. See OnBegin for more.

loop: is exactly what it sounds like: an infinite loop. Inside the loop:

Sleep(IntervalSeconds) pauses the device for the configured number of seconds. This is non-blocking: while we are sleeping, the rest of the island runs normally.

ItemGranter.GrantItem() calls the item granter's GrantItem function. Whatever item is configured on that granter, every applicable player gets one.

That is the entire program. Six lines of meaningful code. Save the file.

Step 3. Build Verse code

Back in UEFN, go to Verse > Build Verse Code. UEFN compiles your Verse and reports any errors at the bottom of the editor. If you typed the code above exactly, you will see "Build Successful." If you see errors, they almost always come from typos: a missing colon, a wrong indent, a forgotten using. Verse is whitespace-sensitive, so indents matter.

After the build succeeds, your timed_reward class shows up in the Content Browser. Search for it. Drag one into your level.

Step 4. Wire it to a real item granter

Place an Item Granter Device in your level. In its Details panel, configure which item it should grant (any consumable works for testing; wood is a classic). Then select your timed_reward device. In the Details panel, find the ItemGranter field and either drag the item granter from the Outliner into it or use the picker.

Save. Push a build. Join your island. Stand around. Every thirty seconds, your inventory ticks up by one of whatever item you configured. You just shipped a Verse-powered device.

Why this tiny script teaches a lot

Step back from the keyboard for a minute and notice what you actually used.

You used a class (timed_reward), the unit of code organization in Verse.

You used inheritance (class(creative_device)), which is how Verse lets your code participate in the device system.

You used typed fields (item_granter_device, float), which is how Verse knows what kinds of things you are talking about and protects you from runtime nonsense.

You used the editor bridge (@editable), which is how Verse code becomes configurable in the visual editor instead of needing a recompile for every tweak.

You used lifecycle hooks (OnBegin), which is how your code knows when to start.

You used a suspends function with Sleep, which is your gateway into Verse's surprisingly powerful model for async behavior. Verse handles waiting, delays, and concurrency through <suspends> instead of callbacks or promises, which is one of the best parts of writing Verse code.

You used a device function call (ItemGranter.GrantItem()), which connects your Verse code to the (options, events, functions) world from day two.

Almost every Verse script you ever write is a denser version of those same ingredients.

Where to go next

You have written your first Verse script. The next steps depend on where you want to push.

If you want to deepen your Verse fluency, read Verse performance patterns. Yes, you are still a beginner; read it anyway. The patterns it describes are not advanced, they are just correct, and learning them now means you never have to unlearn the wrong ones.

If you want to deepen your design fluency, our retention engineering guide explains why some islands keep players coming back and others do not. Even as a newcomer, you can build with retention in mind.

If you want to start a bigger project, our teen series walks through building a complete first map from a clean editor to a published island. It is written for younger creators but works equally well as a "first real project" guide for adults.

And whenever a Verse word, device, or surface confuses you, the glossary is there.

Three days in, you have an editor that feels familiar, a mental model for devices, and a working Verse script. That is more than enough to start building. Go pick a small idea, ship it, and learn from what players do with it.