Build Your First Resource Economy with Verse
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.
Build Your First Resource Economy with Verse
Imagine you are building a treasure hunt. Players need to find coins to buy a key. In Fortnite Creative, those "coins" can be Wood, Stone, or Metal! You can make players gather these items to unlock doors or spawn prizes. It turns a simple game into a real adventure. Let’s learn how to use Verse to make this happen.
What You'll Learn
- What World Resource Items are.
- How to give players resources using devices.
- How to use resources as "tickets" to get rewards.
- How to write simple Verse code to check if a player has enough resources.
How It Works
Think of World Resource Items like special tickets in an arcade. You don’t just pick them up from the air. They are real items in your inventory. There are three types: Wood, Stone, and Metal.
You can drop these items in the world. Players pick them up. Then, they can trade them in. For example, a Vending Machine might cost 10 Wood. If the player has 10 Wood, they get a weapon. If not, nothing happens.
Verse helps us check this. Verse is a language that tells the game what to do. We can write a rule: "If player has 10 Wood, give them a sword." This makes the game smart. It reacts to what the player holds in their hands.
Let's Build It
We will build a simple Resource Shop. A player will walk up to a button. The button will check if they have 5 Wood. If yes, they get a Health Potion. If no, they get a "Not Enough" message.
Here is the Verse code. It uses a Script. A Script is a set of instructions that runs when something happens.
# This script checks for Wood and gives a reward
using { /Fortnite.com/Devices }
using { /Verse.org/Sim }
# We create a new script called ResourceShop
ResourceShop := class(script):
# This runs when the game starts
OnBegin<override>()<suspends>: void=
# We wait for the player to press the button
# We assume a button device is linked in the editor
if button_pressed:
# Check if the player has 5 Wood
if player_has_resource("Wood", 5):
# Give the player a Health Potion
give_reward("Health Potion")
else:
# Tell the player they need more Wood
show_message("Need 5 Wood!")
Let’s break this down.
First, we say using { /Fortnite.com/Devices }. This tells Verse, "Hey, I want to use Fortnite devices." It is like opening a toolbox.
Next, we define ResourceShop. This is the name of our script. Think of it like a blueprint for a machine.
Inside the script, we have OnBegin. This is the start button. When the game begins, Verse reads these lines.
The if statement is very important. It is a fork in the road. It asks a question. "Does the player have 5 Wood?" If the answer is yes, we go one way. If no, we go the other.
In real UEFN, you link a Button device to this script. When the player hits the button, the script runs. It checks the player's inventory. Then it gives the reward.
You do not need to write complex math. Verse handles the counting for you. You just tell it what to look for.
Try It Yourself
Now it is your turn! Open UEFN. Create a new island.
- Place a Button device in the world.
- Place an Item Granter nearby. Set it to give a Health Potion.
- Set the Item Granter to require 5 Wood as a cost.
- Link the Button to the Item Granter in the properties.
Now, test your island. Pick up some Wood. Walk to the button. Press it. Did you get the potion?
Hint: Try changing the cost to 10 Wood. See what happens when you only have 5.
Recap
World Resource Items are Wood, Stone, and Metal. They act like currency in your game. You can use Verse to check if a player has these items. This lets you create shops and challenges. You are now building smarter games!
References
- https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-world-resource-items-in-fortnite-creative
- https://dev.epicgames.com/documentation/en-us/fortnite/using-world-resource-items-in-fortnite-creative
- https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-items-in-fortnite-creative
- https://dev.epicgames.com/documentation/en-us/fortnite/using-items-in-fortnite-creative
- https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-world-resource-consumables-in-fortnite-creative
Verse source files
- 01-standalone.verse · standalone
Turn this into a guided course
Add using-world-resource-items-in-fortnite-creative 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.