The Egg-citing Power-Up Hunt
Tutorial beginner compiles

The Egg-citing Power-Up Hunt

Updated beginner Code verified

The Egg-citing Power-Up Hunt

Do you want to make your Fortnite island feel magical? We can add special eggs that give players superpowers! Imagine finding a glowing egg that makes you float like a balloon or heals your health instantly. We will build a simple treasure hunt where players collect these eggs to win. It is like a video game scavenger hunt. You will learn how to place items and make them do cool things. Let's start our egg-citing adventure!

What You'll Learn

  • How to find special "Egg" items in your inventory.
  • The difference between "Consumables" and "Items."
  • How to place eggs so players can pick them up.
  • How to make a simple win condition using these eggs.

How It Works

Think of an Item as a physical object in your backpack. You can hold it, move it, and give it to friends. A Consumable is a special kind of item. When you use it, it disappears. It is like eating a cookie. The cookie is gone, but you get full!

In Fortnite Creative, we have special Egg Consumables. These are not just for decoration. They have magic powers.

  • The Heal Egg fixes your health bar. It is like a magic potion.
  • The Hop Egg gives you zero gravity. You can jump really high!

We will use a device called an Item Spawner. This device creates eggs out of thin air. It is like a magic box that never runs empty. We will also use a Trigger Volume. This is an invisible box on the floor. When a player steps inside, we check if they have the egg. If they do, they win!

Let's Build It

We will build a "Egg Collector" game. Players must find the eggs. Then they must step on a finish line to win.

First, open your island in Create Mode. Press Tab to open the menu. Click CREATIVE at the top. Click the CONSUMABLES tab. Look for the Heal Egg and Hop Egg. Drag them into your inventory.

Now, let's write the Verse code. This code tells the game what to do when a player gets an egg.

# This is our main script file.
# It manages the egg collection game.

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

# We create a new "Game" device.
# This device holds all our game logic.
egg_collector_game := class(creative_device):

    # A reference to the trigger device placed at the finish line.
    # Wire this up in the UEFN editor by selecting the trigger_device here.
    @editable
    FinishTrigger : trigger_device = trigger_device{}

    # A reference to the item spawner that provides the Heal Egg.
    # Wire this up in the UEFN editor.
    @editable
    HealEggSpawner : item_spawner_device = item_spawner_device{}

    # A reference to the item spawner that provides the Hop Egg.
    # Wire this up in the UEFN editor.
    @editable
    HopEggSpawner : item_spawner_device = item_spawner_device{}

    # We track how many eggs each player has collected using a counter.
    # Both spawners will signal this when a player picks up an egg.
    @editable
    EggCounter : player_counter_device = player_counter_device{}

    # This function runs when the game starts.
    OnBegin<override>()<suspends> : void =
        Print("Welcome to the Egg Hunt! Find the eggs to win!")
        # Listen for players stepping on the finish trigger.
        FinishTrigger.TriggeredEvent.Subscribe(OnPlayerEnteredTrigger)

    # This function runs when a player enters the trigger.
    # It checks if the player has collected enough eggs.
    # note: Verse cannot inspect a player's inventory directly at runtime;
    # we use a counter_device wired to both item spawners' PickedUpEvent
    # to track how many eggs (out of 2) the player has collected.
    OnPlayerEnteredTrigger(TriggeringAgent : ?agent) : void =
        if (Agent := TriggeringAgent?):
            # Get the current count from the counter device.
            # A value of 2 means the player picked up both eggs.
            CurrentCount := EggCounter.GetCount()
            if (CurrentCount >= 2):
                Print("You found all the eggs! You win!")
            else:
                Print("Keep looking! You need more eggs.")```

Here is how to connect this code in UEFN:
1.  Place an **Item Spawner** in your world.
2.  In its properties, set it to spawn the **Heal Egg** and **Hop Egg**.
3.  Place a **Trigger Volume** (like a large invisible box) at the finish line.
4.  Connect the Trigger Volume to a **Script** device.
5.  Paste the code above into the Script device.
6.  Make sure the Script device calls the `OnPlayerEnteredTrigger` function when someone steps in the trigger.

Now, playtest your island! Walk to the egg spawner. Pick up the eggs. Walk to the trigger volume. Did you win? Great job!

## Try It Yourself

Can you make the game harder? Right now, players just need *any* Heal Egg and *any* Hop Egg. What if you wanted them to find **three** Heal Eggs?

**Hint:** You can change the `eggs_to_find` list. You can also count how many eggs a player has by using a loop. Try adding a second Hop Egg to the list and see if the code still works!

## Recap

We learned about **Items** and **Consumables**. Items are things you hold. Consumables are things you use and lose. We used **Egg Consumables** like the Heal Egg and Hop Egg. We placed them with an **Item Spawner**. We used a **Trigger Volume** to check if the player won. You made a real, playable game!

## References

- https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-egg-consumables-in-fortnite-creative
- https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-egg-items-in-fortnite-creative
- https://dev.epicgames.com/documentation/en-us/fortnite/using-egg-items-in-fortnite-creative
- https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-dino-egg-consumables-in-fortnite-creative
- https://dev.epicgames.com/documentation/en-us/fortnite/using-dino-egg-items-in-fortnite-creative

Verse source files

Turn this into a guided course

Add using-egg-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