Verse Starter: How to Build an NPC That Actually Listens (Without Being a Slave Driver)
Verse Starter: How to Build an NPC That Actually Listens (Without Being a Slave Driver)
So, you’ve placed a NPC in your Fortnite island. It looks cool. It stands there. It does absolutely nothing. It’s basically a statue with a health bar, and let’s be honest, that’s not much of a game.
In Fortnite, you’re used to having a squad. You call out positions, you coordinate pushes, you tell your team to heal or rotate. But right now, your NPC is playing hard to get. It doesn’t care about your commands. It doesn’t have a brain (yet).
Today, we’re going to fix that. We’re going to build a Verse Behavior—which is just a fancy term for "the NPC's brain"—so you can give it specific orders. We’ll create a custom NPC that waits for your command, moves to a target, and acts like a loyal (if slightly robotic) soldier. No prior coding experience needed. If you know how to use a Trigger Volume or a Prop Mover, you already know 90% of what you need to understand this.
What You'll Learn
- The Scene Graph & Entities: Understanding that your NPC is just a "thing" in the world with a list of properties, just like a Loot Cube has health, durability, and a loot table.
- Variables as Inventory Slots: How to store information (like "Go Here") so the NPC remembers what you told it.
- Functions as Commands: Creating custom buttons (like "Move Forward") that the NPC executes when you press them.
- The Verse Behavior: The actual code file that ties the NPC’s logic to your island.
How It Works
<!-- section-art:how-it-works -->

NPC Brain Power
The NPC is Just a Character with a Brain
In UEFN, an NPC isn’t magic. It’s an Entity (an object in the game world) that has a Component called a "Behavior." Think of the NPC body as the hardware (the console) and the Verse Behavior as the software (the game cartridge). Without the cartridge, the console is just plastic.
Variables = Your Loadout
Imagine you have a shield potion in your inventory. That’s a Variable. It’s a slot that holds a value. Right now, the slot is empty. We need to create a variable called TargetLocation that holds the coordinates of where the NPC should go.
- Variable: A container that changes. Like your health bar dropping from 100 to 50.
- Constant: A container that never changes. Like the damage of a specific weapon once it’s crafted.
Functions = The "Use" Button
You’ve used Functions before without knowing it. When you press E on a chest, you’re calling the "Open Chest" function. When you press F on a door, you’re calling the "Unlock Door" function.
In Verse, we write our own functions. We’re going to write a function called MoveToTarget. When we call this function, the NPC stops standing around and starts walking.
The Loop: The Game Tick
Games run on a loop. Every frame (about 60 times a second), the game asks: "What should happen now?" This is called the Event Loop. Our NPC needs to check this loop constantly: "Am I at the target? No? Keep walking. Yes? Stop and wait for the next order."
Let's Build It
<!-- section-art:let-s-build-it -->

Listening NPC
We are going to build a simple system:
- Place an NPC.
- Place a "Target" zone (a simple cube or trigger).
- Write Verse code that tells the NPC: "When I say 'Go', move to the Target."
Step 1: The Setup
- Open UEFN and create a new island.
- Place a Custom Character NPC in the world. Let’s call it
MySoldier. - Place a simple prop (like a Crate) where you want the NPC to go. Let’s call it
TargetCrate. - In the Verse Explorer (usually on the right sidebar), right-click and create a new Verse Behavior. Name it
SoldierBehavior.
Step 2: The Code
Open SoldierBehavior.verse. You’ll see a blank slate. Here is the code to make your NPC listen.
# This is the main script for our NPC's brain.
# It inherits from NPCBehavior, which means it has basic NPC powers.
struct SoldierBehavior : NPCBehavior {
# VARIABLES: These are our "inventory slots."
# TargetPosition is a Vector (X, Y, Z coordinates).
# We start with it set to (0,0,0) until we give it an order.
TargetPosition : vector = <0,0,0>
# IsMoving is a boolean (True/False).
# Like a light switch: on or off.
IsMoving : bool = false
# FUNCTION: This is our custom command.
# When we call this, the NPC will start walking.
MoveToTarget := func() {
# Check if we are already moving.
# If yes, do nothing (don't double up on orders).
if (IsMoving) {
return
}
# Set the flag to true. The NPC is now "busy."
IsMoving = true
# Tell the NPC to move to the stored TargetPosition.
# This uses a built-in NPC function called 'Move'.
Move(TargetPosition)
# We'll add logic to stop later, but for now, it just walks!
}
# EVENT: This runs every frame (like checking your health constantly).
OnUpdate := func() {
# If we aren't moving, stop checking. Save battery!
if (!IsMoving) {
return
}
# Get where the NPC is RIGHT NOW.
CurrentPos := GetLocation()
# Check distance to target.
# If we are close enough (within 50 units), stop.
if (Distance(CurrentPos, TargetPosition) < 50.0) {
IsMoving = false
Stop() # Stop the movement animation
}
}
}
Walkthrough: What Just Happened?
struct SoldierBehavior : NPCBehavior: This line says, "I am building a new type of NPC brain based on the standard NPC brain." It’s like taking a base game character and adding a custom skin.TargetPosition : vector: This is your variable. Avectoris just a set of coordinates. Think of it like the GPS coordinates for your next loot drop.MoveToTarget := func(): This is the command. Notice the:=. In Verse, this defines a function. When you callMoveToTarget(), the code inside the curly braces{}runs.if (IsMoving): This is a Condition. It’s like the Storm Timer. If the storm is active, then you take damage. If the NPC is already moving, then ignore the new order.OnUpdate: This is the heartbeat. It runs constantly. It checks: "Am I close to the target? If yes, stop."
Step 3: Connecting It to the Game
Now, the code is written, but the NPC doesn’t know it exists yet.
- Go back to your NPC in the Level Editor.
- In the Details panel, find the Verse Behavior slot.
- Select
SoldierBehavior. - Now, you need a way to trigger
MoveToTarget. You can use a Verse Device or a simple Trigger Volume.- Pro Tip: Use a Trigger Volume. Set it to trigger on "Begin Overlap" with players.
- In the Trigger Volume’s properties, look for "On Begin Overlap." You can’t directly call Verse functions from the editor easily, so the easiest beginner way is to use a Verse Device that listens to player input, or simply hardcode the move into the NPC’s
OnBeginPlayfor testing.
For the sake of this tutorial, let’s assume we want the NPC to move when a player steps on a button. You’d attach a Verse Device to the button that calls SoldierBehavior.MoveToTarget().
Try It Yourself
Challenge: Make the NPC move to a different location when a player steps on a second button.
Hint: You need to update the TargetPosition variable before calling MoveToTarget(). Think about how you’d store the new coordinates. Does the NPC need to know the name of the target, or just the coordinates?
(Don't peek at the solution! Try to figure out how to pass the new location into the function.)
Recap
- NPCs are Entities with Behaviors: The behavior is the code that drives the action.
- Variables store state:
TargetPositionholds where the NPC should go.IsMovingholds whether it’s currently walking. - Functions are commands:
MoveToTargetis the action you trigger. - Events drive the loop:
OnUpdatechecks the world every frame to see if the NPC has reached its goal.
You’ve just written your first NPC logic. It’s not a battle royale mode yet, but it’s a start. Next time, we’ll teach it how to shoot (or at least how to not walk off a cliff).
References
- https://dev.epicgames.com/documentation/en-us/fortnite/verse-starter-01-creating-the-npc-behavior-in-unreal-editor-for-fortnite
- https://dev.epicgames.com/documentation/fortnite/verse-starter-01-creating-the-npc-behavior-in-unreal-editor-for-fortnite
- https://dev.epicgames.com/documentation/fortnite/verse-language-get-started-in-unreal-editor-for-fortnite
- https://dev.epicgames.com/documentation/en-us/fortnite/verse-starter-template-in-unreal-editor-for-fortnite
- https://dev.epicgames.com/documentation/fortnite/verse-starter-template-in-unreal-editor-for-fortnite
Verse source files
- 01-fragment.verse · fragment
Turn this into a guided course
Add verse-starter-template-1-creating-npc-behavior-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.
References
- verse-starter-01-creating-the-npc-behavior-in-unreal-editor-for-fortnite ↗
- verse-starter-01-creating-the-npc-behavior-in-unreal-editor-for-fortnite ↗
- verse-language-get-started-in-unreal-editor-for-fortnite ↗
- verse-starter-template-in-unreal-editor-for-fortnite ↗
- verse-starter-template-in-unreal-editor-for-fortnite ↗
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.