Hide a Secret Weapon with an Item Placer
Tutorial beginner compiles

Hide a Secret Weapon with an Item Placer

Updated beginner Code verified

Hide a Secret Weapon with an Item Placer

Do you want to hide a secret weapon in your Fortnite island? You can place a gun on a table or a sword on a shelf. This makes your island look real. We will use a special device to do this.

What You'll Learn

  • What an Item Placer device is.
  • How to put a weapon inside it.
  • How to make it give the weapon to a player.
  • How to use Verse to reset the weapon.

How It Works

Think of an Item Placer like a magic shelf. It looks like the item it holds. If you put a shotgun on it, it looks like a shotgun. It does not look like a box.

This is different from a chest. A chest is just a box. An Item Placer fits into your world. You can put it on a desk. You can hang it on a wall.

When a player touches the device, they get the item. The item goes into their inventory. The device becomes empty. This is great for treasure hunts. It is also great for secret bases.

We will use Verse to make this work. Verse is the code language for Fortnite. It helps the device know what to give. It also helps us reset the item later.

Let's Build It

We will build a small room. We will put a weapon on a table. A player will touch it to get the gun. Then we will use code to put the gun back.

Step 1: Set Up the Room

  1. Open your Creative Island.
  2. Build a small room with walls.
  3. Place a table in the center.

Step 2: Place the Item Placer

  1. Open the Creative Inventory.
  2. Find the Item Placer device.
  3. Place it on the table.

Step 3: Register the Weapon

  1. Pick up a weapon from your inventory.
  2. Drop it onto the Item Placer.
  3. The device will change shape. It now looks like the weapon.

Step 4: Add the Verse Code

Now we need code. This code makes the device give the weapon. It also resets the weapon after a few seconds.

Here is the code for your Verse file. Copy this into your Verse editor.

# This is the main script for our secret weapon.
# It runs when the island starts.

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

# We create a new object called SecretWeapon.
# This object holds our logic.
SecretWeapon := class(creative_device):
    # This is the Item Placer device.
    # We will connect it later in the editor.
    @editable
    my_placer : item_spawner_device = item_spawner_device{}

    # This is the function that runs first.
    # It sets up the game.
    OnBegin<override>()<suspends> : void =
        # We wait for a player to interact.
        # When they touch the placer, this runs.
        my_placer.ItemPickedUpEvent.Subscribe(OnItemPickedUp)

    # This function runs when a player picks up the item.
    OnItemPickedUp(Agent : agent) : void =
        # We start a background task.
        # It will wait 5 seconds and then reset the placer.
        spawn{ ResetAfterDelay() }

    # This is the function that waits, then resets.
    ResetAfterDelay()<suspends> : void =
        # We wait for 5 seconds.
        Sleep(5.0)
        # We put the item back in the placer.
        my_placer.Enable()```

### How the Code Works

The code has one main actor. An actor is like a character in a game. It has actions.

The `OnBegin` function is the start. It listens for interaction. When a player touches the placer, the game calls `OnItemPickedUp`. This gives the weapon to the player automatically through the device's built-in behaviour.

Then, the code starts a background task with `spawn`. The task waits for 5 seconds using `Sleep`. After 5 seconds, it calls `Enable` on the placer. This puts the weapon back on the table.

### Step 5: Connect the Device

1.  Click on your Verse actor in the editor.
2.  Find the `my_placer` slot.
3.  Drag your Item Placer device into this slot.

### Step 6: Play Your Island

1.  Press Play.
2.  Walk to the table.
3.  Touch the weapon.
4.  You now have the gun!
5.  Wait 5 seconds.
6.  The gun is back on the table.

## Try It Yourself

Can you change the time? Try changing `5.0` to `10.0`. This will make the weapon return after 10 seconds. Can you try a different weapon? Try putting a shield potion on the placer. Does it work the same way?

## Recap

Item Placers make your island look real. They hold weapons on tables and shelves. You use Verse to give the item to players. You also use Verse to reset the item. This creates a fun loop for players.

## References

- https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-item-placer-devices-in-fortnite-creative
- https://dev.epicgames.com/documentation/en-us/fortnite/using-item-placer-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/using-devices-in-fortnite
- https://dev.epicgames.com/documentation/en-us/fortnite-creative/end-of-round-team-swapping-in-fortnite-creative

Verse source files

Turn this into a guided course

Add using-item-placer-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