The Loot Goblin’s Guide: Building a Collectible Economy with Verse
Tutorial beginner compiles

The Loot Goblin’s Guide: Building a Collectible Economy with Verse

Updated beginner Code verified

The Loot Goblin's Guide: Building a Collectible Economy with Verse

So, you've built a map. You've placed some traps. You've made sure the storm hits on time. But it's still just… a map. It lacks juice. It lacks the frantic, sweaty scramble for that one last keycard that saves your life.

That's where Collectible Objects come in. Think of them as the game's economy. In real life, you trade labor for money. In your Fortnite island, players will trade their sweat (and maybe a few eliminations) for loot, weapons, or victory points.

In this tutorial, we're going to build a "Loot Goblin" system. When a player picks up a specific item (like a glowing gem), they don't just get a high-five. They get a weapon, and their score goes up. We'll use Verse to make the game remember who picked it up and reward them accordingly. No more static props that do nothing. Let's make your map feel alive.

What You'll Learn

  • The Scene Graph: Why objects in your world aren't just pictures, but active entities with identities.
  • Variables: How to store a player's score (like an XP bar) that updates in real-time.
  • Events: How to trigger actions (like spawning a weapon) the exact second a player touches an object.
  • Collectible Devices: The specific UEFN device that handles the "pickup" logic, so you don't have to code collision physics from scratch.

How It Works

To understand this, you need to stop thinking like a player and start thinking like the Game Engine.

The Scene Graph: Your World is a Family Tree

In Unreal Engine (and by extension, Verse), everything in your map is part of the Scene Graph. Imagine your island is a giant family tree.

  • The Root is the entire game world.
  • Branches are groups or folders.
  • Leaves are individual items: a wall, a player, a trap, or a collectible gem.

When you place a Collectible Object device in the Creative Editor, you aren't just placing a prop. You are placing a node in this tree. This node has a unique ID. When a player interacts with it, the engine looks at that ID, finds the node, and asks: "Hey, what happens when someone touches you?"

Variables: The Player's Backpack

In programming, a Variable is a container that holds data. It's like a player's inventory slot.

  • If the slot is empty, the variable is 0 or null.
  • If you put a Shield Potion in it, the variable now holds the value 50 (health).
  • You can change what's in the slot at any time.

We will create a variable called PlayerScore. Every time a player picks up a gem, we take the current number in PlayerScore, add 10, and put it back. Simple math, but it drives the entire game loop.

Events: The "On Pickup" Trigger

Games run on Events. An event is a question the engine asks constantly: "Did something happen?"

  • Did a player jump?
  • Did a bullet hit a wall?
  • Did a player touch a collectible?

When that last one happens, the engine fires an Event. Our Verse code will listen for that specific fire alarm and react instantly.

Let's Build It

We are going to create a single, reusable Verse script that attaches to a Collectible Object. When a player picks it up:

  1. The gem disappears (or resets).
  2. The player gets a weapon (we'll simulate this by printing a message, but the logic is there for an Item Granter).
  3. The player's score increases.

Step 1: Set Up the Devices in UEFN

  1. Open your Creative Project.
  2. Place a Collectible Object device. Set its type to "Music Note" (or any item you like).
  3. Place an Item Granter device nearby. Set it to give a weapon (e.g., an Assault Rifle).
  4. Place a Score device (or just use a variable if you're tracking it purely in Verse, but for this demo, we'll keep it simple: the Verse code will handle the logic).

Step 2: The Verse Code

Create a new Verse file in your project folder. Name it LootGoblin.verse. Paste this in:

# LootGoblin.verse
# This script makes a collectible object give rewards and update a score.

using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }

# This is our main device. Think of it as the brain attached to the Collectible Object.
# creative_device is the correct base class for UEFN island scripting.
LootGoblin := class(creative_device):

    # A reference to the Collectible Object device placed in the editor.
    # Drag your Collectible Object device into this slot in the Verse panel.
    @editable
    CollectibleDevice : collectible_object_device = collectible_object_device{}

    # 1. The Variable: A container for the player's score.
    # We start at 0. This is like an empty XP bar.
    # 'var' marks this as mutable so we can change it later.
    var PlayerScore : int = 0

    # 2. The Setup: What happens when the game starts?
    OnBegin<override>()<suspends> : void =
        # Subscribe our handler to the collectible's CollectedEvent.
        # Every time a player picks up the collectible, OnPickup will run.
        CollectibleDevice.CollectedEvent.Subscribe(OnPickup)
        Print("Loot Goblin is awake. Go get those gems!")

    # 3. The Event Handler: called automatically when CollectedEvent fires.
    # CollectedEvent passes the agent (player) who triggered the pickup.
    OnPickup(Agent : agent) : void =
        # Update the score variable.
        set PlayerScore += 10

        # Tell the game what happened.
        Print("A gem was grabbed! Score is now {PlayerScore}")

        # Reward message (see the Pro Version below for the real Item Granter call).
        Print("Reward: You found an Assault Rifle!")

        # Optional: The Collectible Object resets based on its own device settings
        # configured in the UEFN editor (e.g., respawn timer).```

### Wait, where's the Item Granter connection?
You might notice the code above prints "You found an Assault Rifle!" but doesn't actually *give* it. In Verse, to interact with other devices (like an Item Granter), you need to create a **Device Reference**.

Here is the **Pro Version** of the code that actually links to an Item Granter. In the UEFN editor, you would drag the Item Granter device into the `MyGranter` slot in the Verse panel.

```verse
# Advanced LootGoblin.verse
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }

LootGoblin := class(creative_device):

    # A reference to the Collectible Object device in the scene.
    # Drag your Collectible Object into this slot in the Verse panel.
    @editable
    CollectibleDevice : collectible_object_device = collectible_object_device{}

    # A reference to another device in the scene.
    # This is like a remote control pointed at the Item Granter.
    # Drag your Item Granter device into this slot in the Verse panel.
    @editable
    MyGranter : item_granter_device = item_granter_device{}

    # 'var' makes PlayerScore mutable so we can update it during gameplay.
    var PlayerScore : int = 0

    OnBegin<override>()<suspends> : void =
        # Wire the collectible's built-in event to our handler function.
        # Subscribe takes a function that matches the event's signature.
        CollectibleDevice.PickedUpEvent.Subscribe(OnCollectiblePickedUp)
        Print("System Online. Collectibles active.")

    # This handler is called automatically by PickedUpEvent.
    # 'agent' is the Verse type for any participant in the simulation,
    # which includes players. Use it to target per-player devices.
    OnCollectiblePickedUp(Agent : agent) : void =
        # Increase Score.
        set PlayerScore += 100
        Print("Score Updated: {PlayerScore}")

        # Activate the Item Granter!
        # GrantItem takes the agent so the granter knows who to reward.
        MyGranter.GrantItem(Agent)

        # Optional: Play a sound or spawn particles here.
        # Add a sound device reference with @editable and call Enable() on it.

Walkthrough: What Just Happened?

  1. LootGoblin := class(creative_device): We defined a new type of object that UEFN treats as a placeable island device. creative_device is the correct Verse base class for this, not Verse.Actor.
  2. @editable / MyGranter : item_granter_device: The @editable decorator exposes the field in the UEFN editor panel. It's a Reference — a link to the real Item Granter you dragged in.
  3. CollectibleDevice.PickedUpEvent.Subscribe(OnCollectiblePickedUp): This is the Event subscription. PickedUpEvent is the real event on collectible_object_device. Calling .Subscribe() tells Verse: "Run my function every time this fires."
  4. MyGranter.GrantItem(Agent): This is the Function Call. GrantItem takes the agent who triggered the pickup so the item goes to the right player.

Try It Yourself

Challenge: Modify the LootGoblin script to create a "Double Points" zone.

Hint:

  1. Add a new variable called Multiplier and set it to 1.
  2. Add a second Collectible Object that acts as a "Power-Up."
  3. When the Power-Up is picked up, change Multiplier to 2.
  4. Update the score calculation to PlayerScore += (10 * Multiplier).
  5. Bonus: Reset the multiplier back to 1 after 10 seconds using a Timer.

Don't worry if it breaks at first! Coding is like building a ramp: if it's too steep, you'll bounce off. Adjust the angle, try again, and you'll land it.

Recap

  • Scene Graph: Your map is a hierarchy of objects. Every device is a node in this tree.
  • Variables: Containers for data (like scores or ammo counts) that can change during gameplay.
  • Events: Triggers that respond to player actions (like picking up an item).
  • Device References: Links that let your Verse code talk to other devices (like telling an Item Granter to spawn a weapon).

You've just built the backbone of any good Fortnite island: a dynamic economy. Players want rewards for their effort. Now you have the tools to give them exactly that. Go make some loot goblins proud.

References

  • https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-collectible-object-devices-in-fortnite-creative
  • https://dev.epicgames.com/documentation/en-us/fortnite/using-collectibles-object-devices-in-fortnite-creative
  • https://dev.epicgames.com/documentation/en-us/fortnite-creative/design-a-prop-hunt-game-in-fortnite-creative
  • https://dev.epicgames.com/documentation/en-us/uefn/verse-api/fortnitedotcom/devices/collectible_object_device
  • https://dev.epicgames.com/documentation/en-us/fortnite/design-a-prop-hunt-game-in-fortnite-creative

Verse source files

Turn this into a guided course

Add using-collectible-object-devices-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