The Loot Goblin’s Guide to Consumables: How to Give Players Items Without Breaking the Game
Tutorial beginner

The Loot Goblin’s Guide to Consumables: How to Give Players Items Without Breaking the Game

Updated beginner

The Loot Goblin's Guide to Consumables: How to Give Players Items Without Breaking the Game

So, you've built the ultimate arena. You have traps that trigger when they breathe, walls that rise from the earth, and a storm that moves faster than a panic-stricken player. But there's one problem: nobody has anything to use. You've built a weapon range, but there are no weapons. You've built a healing station, but there's no medkit.

In Fortnite Creative, items like medkits, shield potions, launchpads, and jetpacks are called Consumables. They are the lifeblood of any island. Without them, your game is just a very expensive, empty sandbox.

But here's the catch: if you just drop a medkit on the floor, players will pick it up, hoard it, and never use it. Or worse, they'll take it and vanish into the void. To make a real game, you need to control who gets the item, when they get it, and how many they can hold.

In this tutorial, we're going to build a "Respawn Loot Station." When a player respawns, they don't just appear naked. They get a fresh pack of supplies. We'll use Verse to manage their inventory automatically, so you don't have to micromanage every medkit on the map.

What You'll Learn

  • What a Consumable is (and why it's not just a prop).
  • How to give items to players using Verse, rather than dragging and dropping.
  • The "Inventory Slot" concept (why players can only hold so much).
  • Event-Driven Logic (triggering item drops based on gameplay moments like respawning).

How It Works

Before we touch a single line of code, let's look at how Fortnite handles items.

Consumables: The "One-Time Use" Rule

Think of a Consumable like a grenade or a shield potion. It's an item that exists in the game world, but its main purpose is to be used up. In programming terms, a consumable is a Data Object that carries specific properties (like "heals 50 HP" or "launches player").

The Inventory: Your Backpack Slots

Every player has an Inventory. This is like your backpack in Battle Royale. It has limited slots.

  • Variable: The number of items in your backpack.
  • Constant: The maximum slot count (usually 5 or 6, depending on settings).

If you try to give a player a 10th medkit, the game doesn't explode. It usually just drops the extra item on the ground, or ignores it. We want to prevent this chaos. We want to ensure that when a player comes back to life, they have exactly what they need, and nothing more.

The Scene Graph: The "Owner" Relationship

In Unreal Engine (and Verse), everything is part of the Scene Graph. This is just a fancy way of saying "everything has a parent."

  • The Player is a character entity.
  • The Item is an item entity.
  • When you "give" an item, you are creating a link between the Player and the Item. The Player becomes the "Owner" of that item.

If you just place a medkit on the floor, it belongs to the Map. If you use Verse to give it to a player, it belongs to the Player. This distinction is huge. Items owned by the map stay on the map forever. Items owned by players can be dropped, lost, or used.

Let's Build It

We are going to create a simple Verse script that detects when a player Respawns (comes back to life after being eliminated). When that happens, the script will automatically give them:

  1. One Shield Potion (Blue).
  2. One Medkit (Red).

Step 1: The Setup

  1. Open UEFN and create a new island (or use an existing one).
  2. Place a Player Spawn pad in the center of the map.
  3. Go to Island Settings -> Game and make sure Respawn Time is set to something short (like 2 seconds) so you can test it quickly.
  4. Create a new Verse File in your project. Let's call it RespawnLoot.nut (or just RespawnLoot if you're using the modern Verse editor).

Step 2: The Code

Copy and paste this code into your Verse file. Don't worry if it looks scary; we'll break it down line by line.

# This is a comment. It's like a sticky note for yourself.
# The compiler (the program that checks your code) ignores these.

# We need to tell Verse which "parts" of Fortnite we want to use.
# Think of this as checking your backpack before a match.
using { /Fortnite.com/Devices }
using { /Fortnite.com/Characters }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }

# This is the main "Brain" of our script.
# It attaches to a Device (like a Trigger or a Spawn Pad)
# so it knows when to wake up.
RespawnLootDevice := class(creative_device):

    # This is the "Trigger" that watches for players.
    # It's like a sensor that says "Hey, someone just came back!"
    # Wire this slot to a Spawn Pad device in the UEFN Details Panel.
    @editable
    SpawnPad : player_spawner_device = player_spawner_device{}

    # OnBegin runs once when the game session starts.
    # We use it to subscribe to the SpawnPad's SpawnedEvent.
    OnBegin<override>()<suspends> : void =
        # Subscribe: every time the SpawnPad fires SpawnedEvent,
        # call our give_respawn_loot function with the player who spawned.
        # Note: SpawnedEvent expects an agent->void callback.
        # We pass GiveRespawnLoot which takes an agent.
        SpawnPad.SpawnedEvent.Subscribe(GiveRespawnLoot)

    # This is the "Event Listener."
    # It's like a security camera recording.
    # It watches the SpawnPad.
    # Changed signature to accept `agent` to match the event subscription.
    GiveRespawnLoot(Agent : agent) : void =
        # When the spawn pad activates (player respawns), call our function.
        # We need to cast agent to player to get the fort_character.
        if (Player := player[Agent]):
            GiveLootToPlayer(Player)

# This function is the "Action" that happens.
# It takes a Player as an argument.
# Think of it as a vending machine: You put a coin (Player) in, you get a snack (Items) out.
GiveLootToPlayer(Player : player) : void =
    # 1. Check if the player is actually alive.
    # We don't want to give items to a ghost.
    # fort_character is the Verse type for a living Fortnite character.
    if (FortChar := Player.GetFortCharacter[]):
        # 2. Give the Shield Potion.
        # GrantedPickupItemEvent on item_granter_device is the standard
        # Verse-accessible way to hand items to a player.
        # Here we use GiveItem on the fort_character, which is the real API.
        # note: fort_character.GiveItem[] accepts a game_item_definition asset reference.
        # Bind your Shield Potion asset to ShieldPotionItem and MedkitItem
        # via @editable properties on the device (see Step 3 notes).
        FortChar.GiveItem(ShieldPotionPickup)   # Give the Shield Potion
        FortChar.GiveItem(MedkitPickup)          # Give the Medkit```

### Step 3: Connecting the Dots

Now that the code is written, we need to connect it to the game.

1.  Place a **Spawn Pad** device in your level.
2.  In the **Details Panel** (the side menu), look for the **Verse** section.
3.  You should see a slot for **SpawnPad**.
4.  Drag and drop your Spawn Pad device into that slot.
5.  **Save** and **Publish** your island.

### How It Works (The Breakdown)

*   **`using { ... }`**: These are **Imports**. Imagine you're going to build a fort. You need wood, stone, and metal. These lines tell Verse, "Hey, I need access to the Player tools, the Device tools, and the Item tools." Without this, Verse doesn't know what a "Player" or "Item" is.
*   **`RespawnLootDevice := class(creative_device)`**: This defines the **Device** itself. It's a container that holds our logic. It's like a specific type of trap. Every Verse script that lives in a level must extend `creative_device`.
*   **`OnBegin<override>()<suspends>`**: This is a special function that Verse calls automatically when the game session starts. We use it to wire up the SpawnPad's `SpawnedEvent` so our code runs at the right moment.
*   **`GiveRespawnLoot(Player : player)`**: This is a **Function**. A function is a reusable block of code. Think of it like a recipe. You don't write out the steps for baking a cake every time you want one; you just say "Bake Cake." This function says, "Here is the recipe for giving a player items."
*   **`Player.GetFortCharacter[]`**: This is the magic check. `GetFortCharacter[]` is a *failable* expression (note the `[]` brackets), meaning it only succeeds when the player has a living character in the world. If it fails, the `if` block is skipped entirely  so we never try to hand items to a ghost.
*   **`FortChar.GivePickup(...)`**: This tells the game, "Take this item and put it in the character's inventory." It's not dropping it on the floor; it's handing it to them directly.
*   **`SpawnedEvent.Subscribe(...)`**: This is an **Event**. Events are things that *happen* to your device. A player stepping on a trigger is an event. A player respawning is an event. `Subscribe` registers our function so it is called every time that specific moment happens.

## Try It Yourself

You've got the basics down. Now, let's make it harder.

**Challenge:** Modify the code so that when a player respawns, they get **two** Shield Potions instead of one, but **no** Medkit.

**Hint:** Look at the `GiveRespawnLoot` function. You can call `FortChar.GivePickup` more than once. Just make sure you're using the correct pickup reference for the Shield Potion. Don't forget to remove the Medkit line!

*Need a hint on where to find the Item IDs?* They are listed in the `using { /Fortnite.com/Items }` section of the official documentation, or you can look at the Verse autocomplete in the editor as you type `ItemIds.`

## Recap

*   **Consumables** are items that are used up (medkits, potions, launchpads).
*   **Verse** lets you control who gets these items and when, instead of just dropping them on the ground.
*   **Functions** are like recipes: reusable blocks of code that perform actions (like giving items).
*   **Events** are triggers that start your code (like a player respawning).
*   By linking a **Spawn Pad** to a Verse script, you can automate the loot distribution, making your island feel polished and professional.

Now go forth and build islands where players never feel unarmed again. And remember: a good island creator always thinks three steps ahead. If they're respawning, they're going to need ammo. Maybe next tutorial, we'll cover that.

## References

*   https://dev.epicgames.com/documentation/en-us/fortnite/using-travel-items-in-fortnite-creative
*   https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-portable-consumables-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-creative/using-consumables-gallery-devices-in-fortnite-creative
*   https://dev.epicgames.com/documentation/en-us/fortnite/fortnite-glossary

Verse source files

Turn this into a guided course

Add using-travel-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.

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.

Comments

    Sign in to vote, comment, or suggest an edit. Sign in