Build a Healing Station with Verse
Build a Healing Station with Verse
Do you ever get hurt in Fortnite Creative and wish you had a magic healing spot? You can build one! In this tutorial, we will create a special zone. When a player steps in it, their health goes up. It is like a magic potion floor. You will learn how to make your island feel alive. Let’s start coding!
What You'll Learn
- What a Variable is (a box that changes).
- How to use Events (waiting for something to happen).
- How to change a player’s Health with code.
- How to use a Trigger device.
How It Works
Imagine your health bar is a water tank. It holds 100 units of water. When you get hit, water leaks out. We want to add water back in.
We need three things for this magic zone:
- A Trigger: This is like a pressure plate. It knows when a player steps on it.
- A Counter: This is a variable. It counts how many times we heal.
- The Action: This is the code that adds health to the player.
Think of a variable like a scoreboard. The scoreboard starts at zero. Every time someone scores, you add one. Our variable will start at zero. Every time a player enters the zone, we add a little bit of health.
We also need to know who is standing there. The code needs to find the player. Then, it tells the player, "Hey, take 10 more health points!"
Let's Build It
First, place a Trigger device in your island. Make it big. Set it to "Player Only." This means it only cares about players, not animals or props.
Next, we write the Verse code. This code lives inside the Trigger. It listens for players. When a player enters, it heals them.
Here is the code. Copy it into your Trigger’s Verse tab.
# This is our script for the healing trigger.
using { /Fortnite.com/Devices }
# We create a new script type.
# Think of this as the blueprint for our magic floor.
healing_floor_script := script() {
# This event happens when a player enters the trigger.
OnPlayerBeginOverlap := event(player : player) {
# We get the player's current health.
# It is like checking the water level in the tank.
current_health := player.GetHealth()
# We decide how much to heal.
# Let's add 20 points.
heal_amount := 20
# We add the heal amount to the current health.
new_health := current_health + heal_amount
# We cap the health at 100.
# You can't have more than 100 health!
if (new_health > 100) {
new_health = 100
}
# We set the new health on the player.
player.SetHealth(new_health)
# Optional: Print a message to the console.
print("Player healed! New health: ", new_health)
}
}
# This is the main entry point.
# It tells the device to use our script.
Initialize() {
healing_floor_script()
}
Walkthrough
healing_floor_script := script(): This starts our code block. It is like drawing the box on the blueprint.OnPlayerBeginOverlap: This is the Event. It waits for a player to touch the trigger. It is like a doorbell. When it rings, we know someone is there.player : player: This tells the code which player rang the doorbell.player.GetHealth(): This asks the player, "How much health do you have right now?"heal_amount := 20: This is a Constant. We set it once. It will always be 20.player.SetHealth(new_health): This changes the player’s health. It fills the tank up!
Try It Yourself
Now it is your turn to customize!
Challenge: Change the code so the player heals by 50 points instead of 20.
Hint: Look for the line that says heal_amount := 20. Change the number 20 to 50. Save your code and test it in-game.
Warning: If you set it too high, you might skip straight to 100 health instantly! Try 50 first.
Recap
You just built a healing station! You learned that:
- Variables store numbers that can change.
- Events let your code react to players.
- Functions like
GetHealthandSetHealthlet you talk to the player.
Great job! Your island is now safer for players. Keep coding and have fun!
References
- https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-healing-consumables-in-fortnite-creative
- https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-healing-items-in-fortnite-creative
- https://dev.epicgames.com/documentation/en-us/fortnite/using-healing-items-in-fortnite-creative
- https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-consumables-in-fortnite-creative
- https://dev.epicgames.com/documentation/en-us/fortnite/using-items-in-fortnite-creative
Verse source files
- 01-fragment.verse · fragment
Turn this into a guided course
Add using-healing-consumables-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.