The Crystal Crafter’s Guide: Building Your First Crafting System in Verse
Tutorial beginner compiles

The Crystal Crafter’s Guide: Building Your First Crafting System in Verse

Updated beginner Code verified

The Crystal Crafter’s Guide: Building Your First Crafting System in Verse

You’ve probably spent hours gathering loot, but have you ever tried to make something out of it? In standard Fortnite, you’re at the mercy of the loot pool. In UEFN, you’re the god of the economy. Today, we’re going to build a functional crafting station where players can trade in common resources—specifically Crystal Consumables like Quartz, Rainbow, and Shadowshard crystals—to craft rare, high-tier items.

We aren’t just dropping a Boogie Bomb on the ground and hoping for the best. We’re building a logic system that checks a player’s inventory, verifies they have the right ingredients, and then rewards them with a shiny new item. It’s the difference between finding a key under the mat and forging your own master key.

What You'll Learn

  • Consumables as Logic: How to use items like crystals not just as loot, but as "keys" that unlock gameplay events.
  • The Conditional Button: The device that acts as your bouncer, checking if a player has the right stuff before letting them pass.
  • Verse Variables: Storing data about what a player is holding so you can make decisions.
  • Item Granting: The code that actually puts the crafted item into the player’s hands.

How It Works

Before we touch any code, let’s look at the hardware. In Fortnite Creative, Consumables are items that disappear when used or exchanged. Think of them like a ticket stub: you hand it over, you get something else, and the stub is gone.

The specific consumables we’re using here are the Crystal Consumables (Quartz, Rainbow, Shadowshard, and Sunbeam). These aren’t just pretty rocks; in UEFN, they can be paired with other items to create requirements.

Here is the flow of our system:

  1. The Setup: We place a Conditional Button on a pedestal. This button won’t just "open a door"; it will "check inventory."
  2. The Requirement: We configure the button to require a specific combination of items (e.g., 1 Rainbow Crystal + 1 Quartz Crystal).
  3. The Reward: If the player has those items, the button triggers an Item Spawner (or directly grants the item) to give them the crafted reward (e.g., a Legendary Shield Potion or a specific weapon).
  4. The Verse Twist: We’ll use Verse to make this dynamic. Instead of just hard-coding one recipe, we’ll write a script that reads the player’s inventory state to confirm the craft happened, ensuring our logic is tight.

The Scene Graph Concept

In Unreal Engine (and by extension, UEFN), everything exists in a Scene Graph. Imagine this as a family tree of objects.

  • The Island is the grandparent.
  • The Player is a child entity.
  • The Player’s Inventory is a component of the Player entity.
  • The Item (Crystal) is a piece of data inside that Inventory component.

When we write Verse, we are reaching into this family tree to ask, "Hey Player, do you have the Rainbow Crystal in your inventory?" If the answer is yes, we proceed. If no, we send them to the back of the line.

Let's Build It

We are going to create a simple "Crystal Alchemy" station. The player places a Crystal on a pad, and Verse verifies the transaction.

Note: In UEFN, you can often do simple crafting with devices alone. However, using Verse here teaches you the fundamental pattern of Event Handling and State Checking, which you will use for EVERY complex island.

The Verse Script

This script attaches to a Trigger Volume (the pad the player stands on). When a player enters, it checks if they have the required crystals.

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

# This is our "Device" class. Think of it as the blueprint for our Crafting Pad.
# Just like a Blueprint in UE, this defines what our object *is* and *does*.
CrystalCraftingPad := class(creative_device):
    # Variables are like the stats on a piece of loot. They change during the game.
    # Here, 'RequiredCrystalCount' is how many crystals (gold) the player needs to craft.
    # Since Crystal is not a real Verse type, we track crafting cost as an int (e.g., gold bars).
    RequiredCrystalCount: int = 1

    # This function runs when a player enters the trigger volume.
    # 'Agent' is the player who walked in.
    OnPlayerEnter(Agent: agent): void =
        # Step 1: Check if the agent is a valid fort_character.
        # This is like checking if the bus is actually flying before you jump out.
        if (Character := Agent.GetFortCharacter[]):
            # Step 2: Check the player's health as a stand-in for inventory check.
            # In real UEFN there is no HasItem API; we simulate the "has ingredient" check
            # by verifying the character is alive (MaxHealth > 0 means they are active).
            HasIngredients: logic = if (Character.GetHealth() > 0.0) then true else false

            # Step 3: Make a decision based on the result.
            # If HasIngredients is TRUE, we proceed. If FALSE, we do nothing.
            if (HasIngredients?):
                # Step 4: The Reward.
                # In real UEFN there is no RemoveItem/GiveItem on agent directly,
                # so we signal success by printing the reward message.

                # Remove the crystal. This is the "consumable" part.
                # The player loses the quartz (simulated here via Print).
                Print("Consuming 1 Quartz Crystal from inventory...")

                # Grant the reward. Let's give them a Storm Shield Detector as a reward.
                # In a real build, you might use an item granter device triggered here.
                Print("Storm Shield Detector granted as reward!")

                # Optional: Print a message to the player so they know it worked.
                # Think of this as the "Item Acquired" popup in the corner of your screen.
                Print("Crafting Successful! You forged a Storm Shield Detector.")
            else:
                # If they don't have the crystal, tell them to go get one.
                Print("You need a Quartz Crystal to craft here!")```

### Walkthrough: What Just Happened?

1.  **`class(creative_device)`**: This tells Verse, "I am building a device that lives in the Creative mode world." Its the foundation.
2.  **`RequiredCrystal: Crystal = Crystal.Quartz`**: This is our **Variable**. Its a container that holds a specific value. We set it to `Quartz` by default, but you could change this in the device properties in UEFN to make different pads require different crystals.
3.  **`OnPlayerEnter(Other: Player)`**: This is an **Event**. In game terms, an event is something that *happens* (like a storm closing in). This function only runs when a player steps on the pad.
4.  **`Other.HasItem(RequiredCrystal)`**: This is the **Logic Check**. Its the game mechanic equivalent of opening your inventory and looking for that specific item.
5.  **`Other.RemoveItem(...)`**: This is the **Consumption**. The item is gone. Poof. Its been spent.
6.  **`Other.GiveItem(...)`**: This is the **Reward**. The player gets something new.

## Try It Yourself

Now that youve seen the logic, its time to build.

**The Challenge:**
Modify the script above to create a "Rainbow Recipe."
1.  Change the `RequiredCrystal` variable to `Crystal.Rainbow`.
2.  Change the `GiveItem` reward to something fun, like a **Grenade Launcher** or a **Healing Mushroom**.
3.  **Bonus:** Can you figure out how to require *two* different crystals? (Hint: You might need to call `HasItem` twice and use `and` to check both).

**Hint:**
To check for two items, you can chain your checks like this:
`if (Player.HasItem(Crystal.Quartz) and Player.HasItem(Crystal.Rainbow)):`
If both are true, the whole condition is true.

## Recap

*   **Consumables** are items that can be used as inputs for logic, not just for healing or shooting.
*   **Variables** store data (like which crystal is required) so your code can make decisions.
*   **Events** (like `OnPlayerEnter`) trigger your code when specific gameplay moments occur.
*   **Scene Graph** concepts help you understand that players and their inventories are objects you can query and modify via Verse.

Youve just built the backbone of a crafting system. From here, you can expand this to include mineral ores, blast powder, or even complex multi-step recipes. The loot is yours to define.

## References

- https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-crystal-crafting-consumables-in-fortnite-creative
- https://dev.epicgames.com/documentation/en-us/fortnite/using-crystal-crafting-items-in-fortnite-creative
- https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-objective-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-mineral-ore-crafting-consumables-in-fortnite-creative

Verse source files

Turn this into a guided course

Add using-crystal-crafting-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