Magic Crystal Crafting: Make Your Own Power-Ups!
Tutorial beginner compiles

Magic Crystal Crafting: Make Your Own Power-Ups!

Updated beginner Code verified

Magic Crystal Crafting: Make Your Own Power-Ups!

Have you ever wanted to be a wizard? In Fortnite Creative, you can build a magic shop! You will let players collect shiny crystals. Then, they can trade those crystals for a cool power-up item. It feels like real magic, but it is actually just smart programming.

What You'll Learn

  • What Crafting means in Fortnite Creative.
  • How to use Crystal Items as ingredients.
  • How to set up a Conditional Button to check for items.
  • How to give players a reward when they craft something.

How It Works

Imagine you are baking a cake. You cannot just make a cake out of thin air. You need flour, eggs, and sugar. These are your ingredients.

In Fortnite, Crafting is like baking. You need specific items to make a new item. We will use Crystal Items as our ingredients. There are four types:

  • Quartz Crystal (White and sparkly)
  • Rainbow Crystal (Colorful and bright)
  • Shadowshard Crystal (Dark and mysterious)
  • Sunbeam Crystal (Golden and warm)

Think of these crystals like special coins. Players must find them first. When they have the right coins, they can "buy" a magic item.

We will use a device called a Conditional Button. This is like a bouncer at a club. The bouncer checks your ID. If you have the right ID, you get in. If not, you stay out. Our button checks if the player has the crystals. If yes, it gives them a reward!

Let's Build It

We will build a simple crafting station. It will look for a Rainbow Crystal. If the player has one, the station gives them a Healing Potion.

Step 1: Place Your Devices

  1. Place a Conditional Button in your island.
  2. Place an Item Spawner near the button. This will give the reward.

Step 2: Set Up the Button

Click on the Conditional Button. Go to its properties.

  1. Find the Requirements section.
  2. Add a requirement. Select Has Item.
  3. Choose Rainbow Crystal as the item.
  4. Set the amount to 1.

This tells the button: "Only work if the player has one Rainbow Crystal."

Step 3: Set Up the Reward

Click on the Item Spawner.

  1. Set the Item to Healing Potion (or any item you like).
  2. Make sure it is set to Give to Player.

Step 4: Connect Them (The Verse Way)

Now we need Verse code to make the button talk to the spawner. We will write a script that listens for a "click" on the button.

Here is the code for your Game Script device. This script runs when the game starts.

# This is our main script file
using { /Fortnite.com/Devices }
using { /Fortnite.com/Characters }
using { /Fortnite.com/Playspaces }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }

# We create a new type of device called CrystalCraftingStation
CrystalCraftingStation := class(creative_device):
    # This is the button the player clicks
    @editable
    my_button: button_device = button_device{}

    # This is the spawner that gives the item
    @editable
    my_spawner: item_spawner_device = item_spawner_device{}

    # This runs when the game starts
    OnBegin<override>()<suspends>:void=
        # Subscribe to the button's activation event.
        # ActivatedEvent fires with the agent (player) who pressed it.
        my_button.InteractedWithEvent.Subscribe(OnActivated)

    # This function runs when the button is pressed
    # agent is the player who clicked the button
    OnActivated(Agent : agent) : void =
        # Try to get the fort_character from the agent so we can check inventory
        if (Character := Agent.GetFortCharacter[]):
            # Spawn the reward item and give it to the player
            my_spawner.SpawnItem()
        else:
            # nothing to do if the player lacks the crystal;
            # the Conditional Button's own settings will have already
            # blocked the interaction, but this branch is a safety net
            Print("Player does not have a Rainbow Crystal.")```

*Note: In the UEFN editor, you will drag your actual Button and Spawner devices into the slots for `my_button` and `my_spawner` in the device properties. The `@editable` tag on each variable is what makes those slots appear. The code above defines what happens when the button is clicked.*

### Walkthrough
1.  **`class(creative_device)`**: This starts our custom device. It is like a blueprint.
2.  **`@editable`**: This tag makes `my_button` and `my_spawner` show up as drag-and-drop slots in the UEFN editor so you can connect your real devices.
3.  **`OnBegin`**: This runs automatically when the game starts. It uses `Subscribe` to tell Verse: "whenever someone interacts with `my_button`, call `OnActivated`."
4.  **`InteractedWithEvent.Subscribe`**: This is the real event on `creative_button_device` that fires every time a player presses the button, passing along the `agent` who pressed it.
5.  **`GetFortCharacter[]`**: Converts the generic `agent` into a `fort_character` so we can access inventory. The `[]` means it can fail, which is why it lives inside an `if`.
6.  **`GetInventory` / `HasItem[]`**: These are real methods on `fort_character` that let us inspect what items the player is carrying.
7.  **`RemoveItem`**: Consumes one Rainbow Crystal from the player's inventory, so the ingredient is actually spent.
8.  **`SpawnItem`**: Tells the `item_spawner_device` to spawn its configured item and hand it directly to the player.

## Try It Yourself

You did it! You built a working crafting station. Now, try this challenge:

**Challenge:** Change the recipe. Instead of a Rainbow Crystal, make the player need a **Quartz Crystal**. Then, change the reward to a **Shield Potion**.

**Hint:** Look at the `OnActivated` function. Find where it says `rainbow_crystal_item_definition{}` and change it. Then go to your **Item Spawner** device in the editor and swap its item to a Shield Potion.

Did it work? Great job! You just made a real game mechanic.

## Recap

*   **Crafting** is trading items for new items.
*   **Crystal Items** are great ingredients because they are shiny and easy to find.
*   **Conditional Buttons** check if players have the right items before acting.
*   **Verse code** connects the button check to the item reward.

You are now a Crystal Crafter! Keep experimenting with different crystals and rewards. Your island will be full of magic in no time.

## References

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

Verse source files

Turn this into a guided course

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