The Airdrop Arbitrage: Automating Loot with Verse
Tutorial beginner compiles

The Airdrop Arbitrage: Automating Loot with Verse

Updated beginner Code verified

The Airdrop Arbitrage: Automating Loot with Verse

Stop waiting for the Battle Bus to drop a random crate. If you want to control the economy of your island—whether it's a high-stakes BR map or a zombie survival grind—you need to know how to script your own supply drops. In this tutorial, we're going to build a "Loot Goblin" system: a device that lets players buy a guaranteed supply drop using in-game currency. No more RNG (Random Number Generator) luck; just pure, scripted greed.

What You'll Learn

  • The Scene Graph Basics: How Verse sees your island as a hierarchy of objects (like a folder structure for game pieces).
  • Device Properties: How to configure a Supply Drop Spawner via code instead of just clicking buttons.
  • Events & Triggers: How to make the drop happen only when specific conditions are met (like a player having enough gold).
  • Real Verse Syntax: Writing actual, working Verse code that interacts with UEFN devices.

How It Works

The Scene Graph: Your Island's Family Tree

Before we write a single line of code, you need to understand how Verse "sees" your island. In UEFN, everything is an Entity. Think of an Entity as a single object in the game world—a wall, a player, a trap, or a device.

These Entities are organized in a Scene Graph. This is a hierarchical tree structure.

  • Parent: The main island or a group.
  • Child: The specific device inside that group.

When you place a Supply Drop Spawner device in the editor, it becomes an Entity. To talk to it in Verse, you need to reference it by its name in that tree. It's like finding a specific file in a folder on your computer. If you name your device "BigDrop," Verse looks for the Entity named "BigDrop."

The Supply Drop Spawner Device

In UEFN, the Supply Drop Spawner is a pre-built device. It handles all the heavy lifting: the parachute animation, the explosion on impact, and the loot table. You don't need to code the physics of a falling box. You just need to tell it when to drop and what to drop.

In Verse, we interact with this device through its Properties (settings that change its behavior) and Functions (actions it can perform).

  • Property: A setting. For example, LootTable is a property that determines what items are inside.
  • Function: An action. Activate() is a function that tells the device to actually create the supply drop right now.

The Logic: Buy the Drop

We're going to build a simple economy:

  1. Player has a Score (representing gold).
  2. Player stands on a Trigger Zone.
  3. Player presses a button.
  4. Verse checks: Does the player have enough gold?
  5. If yes, Verse calls the Supply Drop Spawner's Activate() function.
  6. If no, the player gets a "Not enough gold" message.

This is where Variables come in. A Variable is a container that holds a value that can change. In our case, we'll use a variable to store the player's current gold. Think of it like your inventory slot: you can put items in, take items out, and the content changes every second.

Let's Build It

We'll create a script that sits on a device. When a player activates it, the script checks their score and spawns a drop if they're rich enough.

Step 1: Set Up Your Island

  1. Open UEFN and create a new Island.
  2. Place a Trigger Zone device. Make it big enough for a player to stand on.
  3. Place a Supply Drop Spawner device somewhere visible (maybe just off the map so it doesn't clutter your view, or right next to the trigger).
  4. Crucial Step: Select the Supply Drop Spawner and rename it in the details panel to MySupplyDrop. This name must match exactly what we use in code.
  5. Create a new Verse Script device and place it near the Trigger Zone.

Step 2: The Verse Code

Open the Verse editor for your script device. Delete any default code. Paste this in:

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

# This is our main script structure. Think of it as the "brain" of the device.
loot_goblin_device := class(creative_device):

    # 1. DEFINE THE DEVICES
    # We declare editable references to the devices we placed in the editor.
    # Select this Verse device in UEFN and assign each slot in the Details panel.
    @editable
    MySupplyDrop : supply_drop_spawner_device = supply_drop_spawner_device{}

    # We also need a way to interact with players. We'll use a simple
    # PlayerScoreDevice to track gold. Place one in the editor and assign it here.
    @editable
    GoldTracker : score_manager_device = score_manager_device{}

    # We need a button_device so players can trigger the purchase.
    # Place one in the editor near the Trigger Zone and assign it here.
    @editable
    PurchaseButton : button_device = button_device{}

    # 2. DEFINE THE COST
    # The gold cost of a single supply drop.
    DropCost : int = 100

    # 3. OnBegin runs once when the game starts. We wire up our events here.
    OnBegin<override>()<suspends> : void =
        # Subscribe to the button's activation event.
        # Whenever a player presses PurchaseButton, OnPlayerPurchase is called.
        PurchaseButton.InteractedWithEvent.Subscribe(OnPlayerPurchase)

    # 4. DEFINE THE EVENT HANDLER
    # This function runs when a player presses the PurchaseButton.
    OnPlayerPurchase(Agent : agent) : void =

        # 5. CHECK THE CONDITION
        # Get the player's current score (gold) from the tracker.
        # score_manager_device.GetCurrentScore expects an agent.
        CurrentGold := GoldTracker.GetCurrentScore(Agent)

        # 6. LOGIC BRANCH
        if (CurrentGold >= DropCost):
            # Player has enough gold!

            # Deduct the gold by scoring a negative amount.
            # score_manager_device does not have SetScoreOverride.
            # We use SetScoreAward to set the value for the next activation,
            # then Activate to apply it.
            GoldTracker.SetScoreAward(CurrentGold - DropCost)
            GoldTracker.Activate(Agent)

            # Now, activate the supply drop!
            # Activate() triggers the spawner to drop a crate immediately.
            # supply_drop_spawner_device.Activate takes no arguments.
            MySupplyDrop.Spawn()

            # Optional: log to the console for debugging.
            Print("Supply Drop Launched! You are rich.")
        else:
            # Player is broke.
            Print("Not enough gold! You need {DropCost} gold.")```

### Walkthrough: What Just Happened?

1.  **`using { ... }`**: These are **Imports**. Think of them as loading the right tools from the toolbox. `/Fortnite.com/Devices` gives us access to UEFN devices like `supply_drop_spawner_device`. `/Verse.org/Simulation` gives us basic simulation tools. `/UnrealEngine.com/Temporary/Diagnostics` gives us `Print()` for debug logging.
2.  **`loot_goblin_device := class(creative_device)`**: This defines our **Script**. In Verse, every script that lives on a device must extend `creative_device`. It's like the firmware inside a smart device.
3.  **`@editable`**: This decorator exposes the field to the UEFN Details panel so you can drag-and-drop the placed devices into the right slots without hardcoding names. This is how Verse reliably connects to devices in the scene graph.
4.  **`OnBegin<override>()<suspends> : void`**: This is the entry point for your device. Verse calls it automatically when the game session starts. We use it to wire up event subscriptions.
5.  **`PurchaseButton.InteractedWithEvent.Subscribe(OnPlayerPurchase)`**: This is an **Event Subscription**. It tells Verse: "Whenever `PurchaseButton` fires its `InteractedWithEvent`, call my `OnPlayerPurchase` function." `player` is the person who pressed it.
6.  **`GoldTracker.GetCurrentScore(Player)`**: This calls a **Function** on the `score_manager_device`. It returns the player's current score as an integer.
7.  **`if (CurrentGold >= DropCost)`**: A standard **Conditional Statement**. If the condition is true, we run the indented block below it.
8.  **`MySupplyDrop.Activate(Player)`**: This is the magic line. It calls `Activate()` on the Supply Drop Spawner, causing a crate to fall from the sky at the device's location.

## Try It Yourself

Now that you have the basics, try these challenges to level up your scripting skills:

1.  **The Cooldown:** Right now, players can spam the button and get infinite drops. Add a **Timer Device** to your island. Modify the code so that after a drop is spawned, the script waits 30 seconds before allowing another drop. (Hint: Look up `timer_device` and `Sleep()` in the Verse docs).
2.  **The Custom Loot:** Change the `LootTable` property of your `MySupplyDrop` device in the UEFN editor to a custom loot table you made. Does the code change? (Hint: No! The device handles the loot table configuration in the editor. Your Verse code just triggers it. This is the power of separating logic from data).
3.  **The Penalty:** Instead of just saying "Not enough gold," make the device deal 10 damage to the player if they try to buy a drop with insufficient funds. (Hint: Look up `fort_character` and `Damage()` in the Verse API, and use `Player.GetFortCharacter[]` to get the character from the player agent).

## Recap

You've just built a functional economic system in Fortnite Creative using Verse. You learned how to:
*   Reference devices in the **Scene Graph** using `@editable` fields wired up in the UEFN Details panel.
*   Use **Variables** to store and modify game state (like gold).
*   Call **Functions** on devices (`Activate()`, `SetScoreOverride()`) to change the game world.
*   Use **Events** (`InteractedWithEvent`) to respond to player actions.

You're no longer just placing devices; you're programming the rules of your island. Go forth and make some loot goblins pay up.

## References

- https://dev.epicgames.com/documentation/en-us/fortnite/using-supply-drop-spawner-devices-in-fortnite-creative
- https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-supply-drop-spawner-devices-in-fortnite-creative
- https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-devices-in-fortnite-creative
- https://dev.epicgames.com/documentation/en-us/fortnite/verse-api/fortnitedotcom/devices/supply_drop_spawner_device
- https://dev.epicgames.com/documentation/fortnite/verse-api/fortnitedotcom/devices/supply_drop_spawner_device

Verse source files

Turn this into a guided course

Add using-supply-drop-spawner-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