Quests: How to Turn Your Island into a Side-Quest Machine
Unverified — this example may not compile as-is.
The Verse code below did not pass our automated compile check, so it isn't marked verified and is hidden from the guide listing. The explanation may still be useful, but treat the code as a draft and adapt it before use.
Quests: How to Turn Your Island into a Side-Quest Machine
So, you've built a map. It's pretty. Maybe there's a gun on a pedestal. But it's boring. Why? Because players don't just want to see things; they want to do things. They want a reason to run from Point A to Point B other than "I'm chasing a ghost."
Enter Quests.
In Fortnite Creative, a Quest is basically a contract between you (the dev) and the player. You give them a goal ("Bring me 5 crystals"), and they get a reward ("XP and bragging rights"). It's the difference between wandering around a lobby and actually playing a game mode.
In this tutorial, we're going to build a simple "Fetch Quest" system using Verse. We'll track if a player has picked up the item, check if they've finished the task, and update their HUD to tell them what's going on. No more guessing. Just clear objectives and shiny rewards.
What You'll Learn
- State Management: How to remember if a player has picked up an item (using variables).
- Conditional Logic: Checking if a task is done so you can reward the player.
- HUD Updates: Showing the player their current objective in real-time.
- The Scene Graph: Understanding how your Verse code talks to the physical objects in your map.
How It Works
Before we write code, let's look at how a Quest works in your head, using Fortnite mechanics you already know.
1. The "Inventory Slot" (Variables)
Imagine you have an inventory slot. Right now, it's empty. That's a variable with a value of False (or 0). When you pick up a potion, that slot flips to True (or 1). The game remembers this state. In Verse, we use Variables to store this information. A variable is just a labeled box where the game stores data that changes during the match.
2. The "Check-In" (Functions & Events)
You walk up to a Quest Giver NPC. They ask, "Did you get the potion?" This is a Function. A function is a reusable block of code that performs a specific task. The NPC checks your inventory (the variable). If the variable is True, they give you XP. If it's False, they tell you to get lost.
3. The "Notification" (HUD)
When you accept the quest, a little message pops up in the corner of your screen: "Objective: Find the Crystal." This is the HUD (Heads-Up Display). It's the UI layer that tells you what's happening without cluttering the 3D world.
4. The Scene Graph (The Skeleton)
Think of your map as a tree. The Scene Graph is the structure of that tree.
- The Root is the whole map.
- Branches are groups (like "QuestObjects").
- Leaves are individual items (like "CrystalProp").
Your Verse code lives in the trunk. It reaches out to the branches to ask, "Hey, is that crystal picked up?" If you don't understand the Scene Graph, your code won't know which crystal to check. We'll make sure your objects are properly named and linked so Verse can find them.
Let's Build It
We're building a Crystal Fetch Quest.
- Player picks up a crystal prop.
- A variable flips to
True. - Player talks to the Quest Giver.
- Verse checks the variable.
- If
True, player gets XP and the HUD updates.
The Setup (Scene Graph)
Before coding, make sure your editor looks like this:
- Crystal Prop: Place a crystal. Name it
CrystalPropin the Outliner. - Quest Giver NPC: Place an NPC. Name it
QuestGiverNPC. - HUD Message Device: Place a HUD Message device. Name it
QuestHUD.
The Verse Code
Copy this into your Verse file. Don't worry if it looks alien; we'll break it down line by line.
# QuestTutorial.verse
using { /Fortnite.com/Devices }
using { /Fortnite.com/Characters }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
# 2. THE QUEST GIVER DEVICE: This is the brain
quest_giver_device := class(creative_device):
# --- VARIABLES (The "Boxes") ---
# HasPlayerCompleted: Remembers if the player did the task.
# Default is false (they haven't done it yet).
# var makes it mutable so we can change it at runtime.
var HasPlayerCompleted : logic = false
# Reference to the trigger_device that wraps the Crystal Prop
# in the Scene Graph. Wire this up in the UEFN Details panel.
@editable
CrystalTrigger : trigger_device = trigger_device{}
# Reference to the HUD message device to show messages.
# Wire this up in the UEFN Details panel.
@editable
QuestHUD : hud_message_device = hud_message_device{}
# OnBegin runs once when the match starts.
# We subscribe to device events here.
OnBegin<override>()<suspends> : void =
# Listen for a player entering the crystal trigger zone.
CrystalTrigger.TriggeredEvent.Subscribe(OnPlayerEnterTrigger)
# --- EVENT: When a player enters the trigger zone ---
# This runs automatically when a player walks near the crystal.
OnPlayerEnterTrigger(TriggeringAgent : ?agent) : void =
if (Agent := TriggeringAgent?):
if (FortChar := Agent.GetFortCharacter[]):
# Check if the player hasn't already done the quest.
if (HasPlayerCompleted = false):
# Flip the variable to true.
set HasPlayerCompleted = true
# Update the HUD to say "Quest Complete!"
# ShowMessage takes a player, so we cast agent -> player.
# note: hud_message_device.Show() displays the device's
# pre-configured message to one player.
if (Player := player[Agent]):
QuestHUD.Show(Player)
# Give the player XP (Reward!)
# note: fort_character.GiveXP is the real API for
# granting experience to a character in UEFN.
FortChar.GiveXP(100)
Print("Player got the crystal! +100 XP")
# --- FUNCTION: When the player talks to the NPC ---
# Hook this up to an npc_interactable_device's InteractedWithEvent
# in the UEFN Details panel, or call it from another device.
# note: Wire an npc_interactable_device's InteractedWithEvent to a
# trigger_device and subscribe here the same way as CrystalTrigger.
OnInteract(TriggeringAgent : ?agent) : void =
if (Agent := TriggeringAgent?):
if (Player := player[Agent]):
if (HasPlayerCompleted = true):
QuestHUD.Show(Player)
else:
# If they talk to the NPC *before* getting the crystal,
# show them the pre-configured "find the crystal" message.
# note: Configure the device's message text in the
# UEFN Details panel for each state, or use a second
# hud_message_device for the "not yet complete" prompt.
QuestHUD.Show(Player)
Walkthrough: What's Happening?
var HasPlayerCompleted : logic = false: This is our Variable. Think of it like a light switch. It starts in theOffposition.logicis Verse's Boolean type — a switch that can only betrueorfalse. Thevarkeyword marks it as mutable, meaning we're allowed to change it later withset.OnPlayerEnterTrigger: This is an Event. Events are things that happen to your code. Just like the Storm closes in automatically, this event fires when a player walks into the zone. We don't call it; the game calls it for us. We subscribed to it inOnBeginusingCrystalTrigger.TriggeredEvent.Subscribe(...).if (HasPlayerCompleted = false): This is Conditional Logic. It's like checking if you have a keycard before opening a door. If the variable isfalse, we let the code inside the block run.set HasPlayerCompleted = true: We flip the switch. Now, if the player tries to do it again, theifstatement will fail, and they won't get double XP. This prevents cheating.FortChar.GiveXP(100): This is a Function provided by Fortnite's API. It's a pre-built tool that says, "Give this character 100 XP." We don't need to write the math for XP; we just call the function.QuestHUD.Show(Player): This displays the configured message on the player's screen. It's like changing the text on a billboard in-game.
Try It Yourself
Now that you have the basics, try to add a twist.
Challenge: Make the quest reset if the player leaves the island or dies.
Hint: You'll need to use another Event. Look for an event that fires when a player is eliminated or leaves the match. Then, inside that event, set HasPlayerCompleted = false. This resets the "light switch" so they can do the quest again next time they spawn.
Don't forget to update the HUD message too, or the player will be confused why their "Quest Complete" message is still there!
Recap
- Variables are boxes that store data (like
true/false) that changes during the game. - Events are triggers that run code automatically (like when a player enters a zone).
- Functions are tools you call to do things (like giving XP or changing HUD text).
- The Scene Graph connects your code to the physical objects in your map. Make sure your props are named correctly!
Quests are the backbone of any engaging Fortnite island. They give players purpose, direction, and a reason to come back. Now go make something they'll actually want to finish.
References
- https://dev.epicgames.com/documentation/en-us/fortnite/lets-play-in-fortnite-creative
- https://dev.epicgames.com/documentation/en-us/fortnite-creative/playing-games-in-fortnite-creative
- https://dev.epicgames.com/documentation/en-us/fortnite/creating-conversations-in-unreal-editor-for-fortnite
- https://dev.epicgames.com/documentation/en-us/fortnite/lego-action-adventure-in-unreal-editor-for-fortnite
- https://dev.epicgames.com/documentation/en-us/fortnite/talisman-environment-template-in-unreal-editor-for-fortnite
Verse source files
- 01-device.verse · device
Turn this into a guided course
Add Quests 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.