The Flopper Factory: Automating Loot Drops 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.
The Flopper Factory: Automating Loot Drops with Verse
Remember that feeling when you finally catch a big fish in Zero Build, only to realize you're too far from a healing zone to use it? Or maybe you've built a trap that kills enemies but gives them zero loot? Boring.
In this tutorial, we're going to stop placing consumables manually and start building a Flopper Dispenser. We'll use Verse to create a system that detects when a player picks up a "Loot Box" (or just walks through a trigger), checks their inventory, and automatically spawns a specific type of Flopper right into their hand.
You'll learn how to talk to the game's inventory system, how to check if a player has space, and how to spawn items dynamically. No more hoarding fish in your pocket while your health hits zero. Let's code some chaos.
What You'll Learn
- Variables: How to store the "type" of Flopper you want to spawn (like setting a trap's damage value).
- Inventory Checks: How to ask the game, "Does this player have room for another item?" (The "Backpack Space" concept).
- Spawning Items: How to use Verse to force an item into a player's hand or inventory.
- Events: How to make the dispenser react when a player touches it (like a pressure plate).
How It Works
Think of a Flopper not just as a healing item, but as a buff ticket. A Snowy Flopper heals you. A Hop Flopper makes you jump higher. A Vendetta Flopper gives you revenge buffs. In Fortnite Creative, these are all just different types of the same "Flopper" object.
In Verse, we don't just "drop" an item on the floor and hope someone picks it up. We interact directly with the Inventory Component.
The Scene Graph & The Inventory
In Unreal Engine 6 (and Verse), everything is part of a Scene Graph—a hierarchy of objects. Your player character has a component called FortInventoryComponent. This is literally their backpack.
When you want to give a player a Flopper, you aren't throwing a prop. You are calling a function on that component: AddItem. But before you can add it, you need to know:
- What item? (Is it a Snowy Flopper or a Shadow Flopper?)
- Is there room? (If their inventory is full, the item stays in the "limbo" or is lost. We don't want that.)
The Logic Flow
- Detect: A player enters a specific zone (we'll use a Trigger Volume).
- Check: We look at the player's inventory to see if they have an empty slot.
- Act: If there's space, we add the Flopper to their inventory.
- Feedback: We might flash the zone green to show "Success!"
Let's Build It
We are going to build a "Loot Goblin Box." When a player touches it, they get a random Flopper. If their inventory is full, they get nothing (and maybe a little shake effect, but let's keep it simple for now).
Step 1: The Setup
- Open UEFN.
- Place a Trigger Volume (from the Devices menu). Make it big enough to stand in.
- Place a Prop (a simple box or a fish model) next to it to represent the "Goblin."
- Open the Verse Editor for the Trigger Volume.
Step 2: The Code
Copy this into your Verse script. I've annotated every line so you know exactly what's happening.
using { /Fortnite.com/Devices }
using { /Fortnite.com/Characters }
using { /Fortnite.com/Game }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
# We define our own "Flopper Dispenser" device.
# Think of this as the blueprint for our Loot Box.
flopper_dispenser_device := class(creative_device):
# VARIABLES: These are the settings you can change in the UE Editor panel.
# This is like setting the "Damage" on a trap, but here we set which
# item-granter device hands out the Flopper.
# We wire a item_granter_device in the editor — it is pre-configured
# with the Flopper type you want (e.g. Snowy Flopper).
@editable
FlopperGranter : item_granter_device = item_granter_device{}
# We also need a trigger_device to detect the player walking in.
# Wire this to your Trigger Volume in the editor.
@editable
EntranceTrigger : trigger_device = trigger_device{}
# OnBegin runs once when the game session starts.
# We use it to subscribe to the trigger's event — like plugging
# the doorbell wire into the chime.
OnBegin<override>()<suspends> : void =
# Subscribe: whenever the trigger fires, call OnPlayerEntered.
EntranceTrigger.TriggeredEvent.Subscribe(OnPlayerEntered)
# This function fires every time the trigger activates.
# 'Agent' is whoever set it off — could be a player.
OnPlayerEntered(Agent : agent) : void =
# 1. Check if the agent is a Fortnite player character.
# cast to fort_playspace_character gives us access to player actions.
# note: agent is already the correct type for GrantItem; we cast
# purely to confirm this is a real player and not an NPC/prop.
if (Player := agent as fort_character):
# 2. Use the pre-configured item_granter_device to hand the
# Flopper directly to the player's inventory.
# item_granter_device handles slot-availability internally:
# if inventory is full it will not grant the item.
FlopperGranter.GrantItem(agent)
# 3. Feedback — print to the Verse log so you can verify
# in the Output Log tab that the grant was attempted.
Print("Flopper dispensed to player!")
else:
# Whatever entered the trigger was not a player — ignore it.
Print("Non-player entered trigger, ignoring.")
Walkthrough: What Just Happened?
class(creative_device): We are extending the basecreative_deviceclass, which is the real Verse base type for all placeable island logic. This gives us theOnBeginlifecycle hook so the game calls our setup code automatically when the session starts.FlopperGranter : item_granter_device: This is your Variable. A variable is a container that holds data. In-game, think of this like the "Ammo Type" setting on a weapon device. You configure theitem_granter_devicein the editor (setting it to Snowy Flopper, Hop Flopper, etc.), and the Verse code reads that setting at runtime. The@editableattribute is what makes the field appear in the Details panel.EntranceTrigger.TriggeredEvent.Subscribe(OnPlayerEntered): This is the Event subscription. Instead of overriding a collision callback directly, Verse devices communicate through subscribable events.Subscribeis like handing someone your phone number — when the trigger fires, it calls your function.agent as fort_character: This is the Type Check. Imagine a bouncer at a club. The bouncer (your code) checks if the person (theAgent) has the right ID (is a playable character). If they're a tree or a wall, the bouncer doesn't let them in. Theif (Player := agent as fort_character)syntax checks the ID and, if it matches, saves the character intoPlayerfor later use.FlopperGranter.GrantItem(agent): This is the Function call. A function is a block of code that does a specific job. Here, the job is "Put this item in this backpack."item_granter_device.GrantItemis the real UEFN API for handing an item to a player; it respects inventory limits and item stacking automatically.
Try It Yourself
The code above gives a Snowy Flopper (because that's what you configured in FlopperGranter). But the real fun is in the variety.
Challenge: Modify the setup to give a Hop Flopper instead.
Hint: You do not need to change any Verse code at all. The item type lives in the item_granter_device settings, not in the script. To switch Floppers:
- Select your
item_granter_deviceon the island. - In the Details panel, find the Item to Grant property.
- Search for "Hop Flopper" and select it.
- Play-test — the same Verse script now dispenses a Hop Flopper.
Bonus Challenge: What happens if you try to add an item to a player who already has a full inventory? (Hint: Check the Epic docs on item_granter_device behavior at capacity — does it drop the item on the floor, silently fail, or queue it?)
Recap
You just built a device that talks to the game's inventory system. You learned that:
- Variables (
@editablefields) let you store settings (like which Flopper to grant) in the editor without touching code. - Events (
TriggeredEvent.Subscribe) let your code react to player actions. - Functions (
GrantItem) let you change the game state (give items) directly.
Now go forth and dispense fish. May your inventory always have space.
References
- https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-flopper-consumables-in-fortnite-creative
- https://dev.epicgames.com/documentation/en-us/fortnite/using-flopper-items-in-fortnite-creative
- https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-flopper-items-in-fortnite-creative
- https://github.com/vz-creates/uefn
Verse source files
- 01-device.verse · device
Turn this into a guided course
Add using-flopper-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.