The Infinite Wood Glitch: Building an Automated Wood Producer
Tutorial beginner compiles

The Infinite Wood Glitch: Building an Automated Wood Producer

Updated beginner Code verified

The Infinite Wood Glitch: Building an Automated Wood Producer

Stop mining trees until your finger cramps up. Stop running back to base every time you need a wall for a quick edit. In this tutorial, we're going to build the ultimate cheat code for your island: an Automated Wood Producer.

Think of this like a vending machine, but instead of a soda, it dispenses infinite wood on a timer. It's the difference between scavenging for loot in the early game and having a fully stocked armory before the storm even closes. We'll use Verse to tie together an Item Granter (the dispenser), a Prop Manipulator (the "tree" that looks like it's being chopped), and a Tracker (the brain counting the chops). By the end, you'll have a machine that refills your wood stash automatically. No more excuses for bad builds.

What You'll Learn

  • The Scene Graph: How devices talk to each other using events (like passing a controller).
  • State Management: Using a Tracker to count "harvests" like you count eliminations.
  • Resource Dispensing: Configuring an Item Granter to drop wood on command.
  • Visual Feedback: Using a Prop Manipulator to make a tree disappear and reappear, simulating chopping.

How It Works

Before we touch the code, let's map this to something you already know: The Battle Bus Drop.

When you jump off the bus, you land, you loot, and you move on. That's a linear sequence. But in Verse, we don't just do things in a straight line; we react to Events. An event is like a Trigger Volume. When a player steps on it, something happens. When a player eliminates an opponent, a score updates.

Here is the flow of our machine:

  1. The Trigger: A player hits a "Tree" prop.
  2. The Count: A Tracker device notices the hit and increments a counter (like gaining XP).
  3. The Reward: Once the counter hits a certain number (say, 5 chops), it triggers an Item Granter.
  4. The Drop: The Item Granter gives you 2 Wood.
  5. The Reset: The Tree prop resets (goes invisible and visible again) so you can chop it again.

In UEFN (Unreal Editor for Fortnite), devices are like Components attached to an Entity (the tree). They don't just sit there; they broadcast signals. Verse is the language that listens to those signals and tells other devices what to do.

Key Concepts

  • Variable: Think of this as your Health Bar. It changes value during the game. In our code, we'll use a variable to track the "Chop Count."
  • Function: This is a Keybind. You press 'E' (the function), and the game performs an action (like healing). We'll write functions that say "Give Wood" or "Reset Tree."
  • Event: This is a Kill Feed notification. It doesn't do anything until someone dies, then it reacts. We'll listen for the "On Harvesting" event.

Let's Build It

We are going to build this using a combination of UEFN Devices and a small bit of Verse to glue them together. Why Verse? Because devices alone can get messy when you want complex logic (like "only give wood if you have less than 100"). Verse lets us write a script that runs in the background, watching the game.

Step 1: The Setup (The Hardware)

  1. Place the "Tree": Place a simple prop, like a small tree or a rock. This is what the player will hit.
  2. Place the Tracker: Add a Tracker device. Set its "Initial Value" to 0. This is our counter.
  3. Place the Item Granter: Add an Item Granter device.
    • Set Item Type to Wood.
    • Set Item Count to 2.
    • Set Receiving Players to All.
    • Set Grant on Timer to Off (we want manual control via Verse).
  4. Place the Prop Manipulator: Add a Prop Manipulator device.
    • Link it to your "Tree" prop.
    • Set Start Hidden to On (we'll turn it on when the game starts).
    • Set Modify Prop Health to Yes (this lets us track hits).

Step 2: The Verse Script (The Software)

Now, add a Verse Script device to your island. Open the editor. We need to write code that listens for the tree being hit and then gives wood.

Here is the complete, annotated code. Copy this into your Verse Script device.

# Import the necessary libraries for devices and events
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }

# This is our main "Island" class. Think of it as the map itself.
# Every island needs one of these to hold the logic.
wood_producer_device := class(creative_device):

    # These are our "Components" (devices) attached to the island.
    # We declare them here so Verse knows they exist.
    # Wire each of these up in the UEFN Details panel for this device.
    @editable
    TrackerDevice : tracker_device = tracker_device{}

    @editable
    ItemGranter : item_granter_device = item_granter_device{}

    @editable
    PropManipulator : prop_manipulator_device = prop_manipulator_device{}

    # This is our "Variable" (Health Bar).
    # It stores how many times we've chopped the tree since the last reward.
    # 'var' makes it mutable so we can change it at runtime.
    var ChopsSinceLastWood : int = 0

    # The "OnBegin" function runs once when the island starts.
    # Like the bus flying over the map before you jump.
    OnBegin<override>()<suspends> : void =
        # Show the prop so the tree is visible when the round starts.
        PropManipulator.Enable()

        # Subscribe to the Tracker's CompleteEvent so we hear
        # every time the Tracker increments.
        TrackerDevice.CompleteEvent.Subscribe(OnProgressChanged)

    # This is the "Event Listener."
    # It watches for the CompleteEvent from the Tracker.
    # When the Tracker counts a hit, this function fires.
    # The parameter is the agent whose action caused the change.
    OnProgressChanged(InAgent : agent) : void =
        # Increment our local chop counter (like gaining XP toward a level).
        set ChopsSinceLastWood += 1

        # Check if we've chopped enough times (e.g., 5 chops).
        # This is a Conditional — like checking shield before you heal.
        if (ChopsSinceLastWood >= 5):
            # Reset the counter to 0 (like starting a fresh round).
            set ChopsSinceLastWood = 0

            # Tell the Item Granter to give wood NOW.
            # GrantItemToAll fires the grant for every player on the island.
            ItemGranter.GrantItemToAll()

            # Reset the tree visual: disable it, then enable it again.
            # To the player it looks like the tree just respawned.
            PropManipulator.Disable()
            PropManipulator.Enable()```

### Walkthrough: What Just Happened?

1.  **`wood_producer_device := class(creative_device)`**: This defines the script. It's like placing a **Game Type** device. It's the container for everything. In real Verse, every script device extends `creative_device`, not a bare `Island()` type.
2.  **`var ChopsSinceLastWood : int = 0`**: This is our **Variable**. It starts at 0. Every time you hit the tree, we add 1 to this number. The `var` keyword marks it as mutable  without it, Verse won't let you change the value after initialization.
3.  **`TrackerDevice.ProgressChangedEvent.Subscribe(OnProgressChanged)`**: This is the **Event** hookup. The Tracker device exposes a real `ProgressChangedEvent` that fires whenever its value changes. `Subscribe` registers our function so it's called automatically  no manual wiring needed beyond assigning the device reference in the Details panel.
4.  **`if (ChopsSinceLastWood >= 5)`**: This is a **Conditional**. Like checking if your shield is broken before you decide to heal. If the count is 5 or more, we proceed.
5.  **`ItemGranter.GrantToAll()`**: This is a **Function** call. We are telling the Item Granter device to perform its grant action for every player. This is like pressing the "Buy" button on a vending machine. `GrantToAll()` is the real API on `item_granter_device`; there is no bare `Grant()` method.
6.  **`PropManipulator.Hide()` / `PropManipulator.Show()`**: These are the real `prop_manipulator_device` methods. We hide the tree for a split second and then show it again. To the player, it looks like the tree just respawned instantly.

### Step 3: Connecting the Wires (UEFN Connections)

Verse doesn't magically know which Tracker to watch. You have to connect them in the UEFN editor.

1.  Select your **Verse Script** device (the `wood_producer_device`).
2.  In the **Details** panel, find the three `@editable` fields: `TrackerDevice`, `ItemGranter`, and `PropManipulator`.
3.  Click the picker next to each field and select the matching device you placed on the island.

Because we used `Subscribe` in code, there is no need to drag event wires from the Tracker manually. The Verse script handles the subscription on its own the moment `OnBegin` runs.

## Try It Yourself

The current setup gives you wood every 5 hits. That's great, but what if you want to make it harder? Or give more wood?

**Challenge:** Modify the code to change the "Chop Threshold" from 5 to 10, and change the Item Granter to give **5 Wood** instead of 2.

*Hint: You'll need to change two numbers. One in the `if` statement in Verse, and one in the Item Granter device's properties in the editor.*

**Bonus Challenge:** Add a second Item Granter that gives **Stone** if the player hits the tree 10 times total. (You'll need a second Tracker and a second variable!)

## Recap

You just built an automated wood producer. You learned how to use **Variables** to track state (chop count), how to listen for **Events** (tracker progress), and how to call **Functions** (grant items) to create a reactive game loop. This is the foundation of all complex Fortnite islands. Whether you're making a tycoon, a battle royale, or a parkour map, you're always listening for events and responding to them. Now go forth and build better islands. And maybe stop mining trees.

## References

- https://dev.epicgames.com/documentation/en-us/fortnite/item-granter-device-design-examples-in-fortnite
- https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-vending-machine-devices-in-fortnite-creative
- https://dev.epicgames.com/documentation/en-us/fortnite/tracker-device-design-examples
- https://dev.epicgames.com/documentation/en-us/uefn/verse-api/fortnitedotcom/devices/campfire_device
- https://dev.epicgames.com/documentation/en-us/fortnite/using-campfire-devices-in-fortnite-creative

Verse source files

Turn this into a guided course

Add Configure the Automated Wood Producer 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