The Magic Kitchen: Healing with Produce in Fortnite
The Magic Kitchen: Healing with Produce in Fortnite
Have you ever played a game where you got hurt and needed to eat something to feel better? Maybe you ate a banana or drank some milk. In Fortnite Creative, you can build your own healing system!
We are going to make a "Magic Kitchen." When a player steps on a special rug, they will get a healthy snack. This snack will heal their health bar. It is like a real-life first aid kit, but made of virtual food!
What You'll Learn
- What Produce items are and how they heal players.
- How to use the Item Granter device to give food to players.
- How to connect a Trigger Volume to start the healing.
- How to place these items in your own island.
How It Works
Imagine you are playing a video game. You are fighting a boss. You lose some health. Suddenly, you find a red apple. You eat it. Pop! Your health goes back up. That is what Produce items do.
Produce items are special food objects. They give players a little bit of health back. The most common one is the Pepper. It gives 15 health points. That is a big boost!
To make this happen in your island, we need two main parts:
- The Trigger: This is like a pressure plate. When a player walks on it, something happens. In Verse, we call this a Trigger Volume.
- The Gift: This is the Item Granter. It holds the food. When the trigger is pressed, it gives the food to the player.
Think of it like a vending machine. You put a coin in (step on the trigger). The machine gives you a soda (the Item Granter gives you the Pepper).
We will use a simple script to connect these two. The script watches the trigger. When the trigger is "on," the script tells the Item Granter to give a Pepper to the player who stepped on it.
Let's Build It
Here is the code for our Magic Kitchen. It is short and sweet.
# This is our main script file.
using { /Fortnite.com/Devices }
using { /Fortnite.com/Characters }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
# We create a new creative_device type.
# Think of this as the "brain" of our kitchen.
magic_kitchen_script := class(creative_device):
# These are the devices we will use.
# A 'trigger' is the rug on the floor.
@editable
Trigger : trigger_device = trigger_device{}
# An 'item_granter' is the machine that holds the food.
@editable
ItemGranter : item_granter_device = item_granter_device{}
# This runs once when the game starts.
OnBegin<override>()<suspends>: void =
# We tell the trigger to watch for players.
# When a player enters, it calls 'OnTriggered'.
Trigger.TriggeredEvent.Subscribe(OnTriggered)
# This function runs when a player steps on the rug.
# '?agent' is the Verse type for the entity that activated the trigger.
OnTriggered(Agent : ?agent) : void =
# We cast the agent to a fort_character so we can find the player.
# note: GrantItem uses the agent directly; no ProduceItemTypes enum exists in public API.
if (ActualAgent := Agent?):
if (FortCharacter := ActualAgent.GetFortCharacter[]):
# item_granter_device.GrantItem takes the activating agent.
# The specific item (Pepper) is set in the Item Granter device
# settings inside UEFN — see the placement steps below.
ItemGranter.GrantItem(ActualAgent)```
### Walkthrough
1. **`magic_kitchen_script := class(creative_device)`**: This line creates our script. It is like drawing the blueprint for our kitchen brain.
2. **`Trigger : trigger_device`**: This connects the script to the Trigger Volume device in your level. You place this device on the floor. It looks like a square zone.
3. **`ItemGranter : item_granter_device`**: This connects the script to the Item Granter device. You place this device near the trigger.
4. **`OnBegin`**: This is the start-up sequence. It tells the trigger, "Hey, watch for players!"
5. **`OnTriggered`**: This is the magic moment. When a player steps on the trigger, this code runs. It takes the player's ID (their unique name tag) and gives them a Pepper.
### How to Place It in UEFN
1. Place a **Trigger Volume** device. Make it big enough for a player to stand on.
2. Place an **Item Granter** device nearby.
3. Open the Item Granter settings. Change the **Item Type** to **Pepper**.
4. Add a **Verse Device** to your level.
5. Paste the code above into the Verse Device.
6. In the Verse Device settings, drag the Trigger Volume into the **Trigger** slot.
7. Drag the Item Granter into the **Item Granter** slot.
8. Play your island! Step on the rug. Watch your health go up!
## Try It Yourself
You made a Pepper heal you. Now, let's make it more interesting.
**Challenge:** Change the script so it gives a **Corn** instead of a Pepper.
**Hint:** The item given is controlled by the **Item Granter device settings** in UEFN, not in the Verse code itself. Open the Item Granter properties panel and change the **Item Type** from **Pepper** to **Corn**. Try it and see if the icon changes!
## Recap
* **Produce** items are food that heals players.
* The **Trigger Volume** detects when a player steps on a spot.
* The **Item Granter** holds the food and gives it to the player.
* Verse connects these devices together to make magic happen.
Now you can build healing zones, food courts, or even a cafeteria for your island players. Great job, coder!
## References
* https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-produce-items-in-fortnite-creative
* https://dev.epicgames.com/documentation/en-us/fortnite/using-produce-items-in-fortnite-creative
* https://dev.epicgames.com/documentation/en-us/fortnite/using-food-crafting-items-in-fortnite-creative
* https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-produce-consumables-in-fortnite-creative
* https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-food-crafting-consumables-in-fortnite-creative
Verse source files
- 01-device.verse · device
Turn this into a guided course
Add using-produce-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.