The Trap Master’s Guide: How to Weaponize Your Island with Verse
Unverified — this example may not compile as-is.
The Verse code below did not pass our automated compile check, so it isn't marked verified and is hidden from the guide listing. The explanation may still be useful, but treat the code as a draft and adapt it before use.
The Trap Master's Guide: How to Weaponize Your Island with Verse
You know the feeling. You're camping a high-ground hold, feeling safe, when suddenly a Cozy Campfire appears out of nowhere to heal your enemy, or a Damage Trap turns your favorite loot chest into a one-way ticket to the lobby. In standard Fortnite, traps are RNG loot. In Creative, they're just props—until you give them a brain.
Today, we're stopping the RNG and starting the revenge. We're going to build a "Trap Gadget" using Verse. This isn't just placing a bouncer; it's creating a device that spawns traps on command. Think of it like giving yourself a limited-use inventory of deadly surprises. We'll cover variables (your ammo counter), functions (the trigger mechanism), and the scene graph (where the trap actually lives in the world). By the end, you'll have a working gadget that spawns a bouncer right under your feet when you need an escape route.
What You'll Learn
- Variables as Inventory: How to track how many traps you have left using a simple counter.
- Functions as Gadgets: How to package a complex action (spawn + position) into a single button press.
- The Scene Graph: Understanding where objects exist in the 3D world so your trap doesn't spawn inside a wall.
- Verse Basics: Writing your first functional script that interacts with the game world.
How It Works
In standard Fortnite, you pick up a trap from a chest, hold it in your hand, and place it. It's a physical object. In Verse, we treat trap placement like a function call.
Imagine you have a Launch Pad in your inventory. Normally, you press a button to deploy it. In Verse, we're going to create a "Gadget" device. This device holds a variable (let's call it TrapsRemaining). Every time you use the gadget, we check if TrapsRemaining is greater than zero. If it is, we run a function that:
- Finds a safe spot on the ground near you.
- "Instantiates" (spawns) a trap item at that spot.
- Subtracts one from
TrapsRemaining.
If TrapsRemaining hits zero, the gadget jams. No more traps. This is the core loop of almost every game mechanic: Check State -> Perform Action -> Update State.
The Scene Graph: Where Does It Live?
Before we code, you need to understand the Scene Graph. Think of the Scene Graph as the family tree of every object in your island.
- The Island is the parent.
- Props, Players, and Devices are children.
- Components (like the mesh or the collision box) are grandchildren.
When we spawn a trap, we aren't just throwing a rock. We are adding a new "child" to the Scene Graph at a specific coordinate (X, Y, Z). If we don't specify the location, the trap might spawn inside your character's head, which is hilarious for five seconds and then game-breaking. We need to tell Verse: "Spawn this trap 2 meters in front of the player."
Let's Build It
We are building a Bouncer Gadget. When you equip this gadget and press the use button, it spawns a Bouncer trap 2 meters in front of you and consumes one charge.
Step 1: The Setup
- Open UEFN and create a new island or open an existing one.
- Place a Player Spawn point.
- Place a Verse Device (you can find this in the Content browser under "Verse" -> "Verse Device"). Name it
BouncerGadget. - In the Verse Device's settings, make sure it's set to "Server" authority (so only the server controls the spawning, preventing cheating).
Step 2: The Code
Open the Verse script editor for your BouncerGadget. Delete the default code and paste this in. Don't panic—we'll break it down line by line.
using { /Fortnite.com/Devices }
using { /Fortnite.com/Characters }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /UnrealEngine.com/Temporary/SpatialMath }
using { /Verse.org/Simulation }
# We are defining a new type of object called a Gadget.
# This is like creating a new blueprint for a device.
bouncer_gadget := class(creative_device):
# This is our VARIABLE. Think of it as your "Ammo Counter."
# It starts at 3, meaning you get 3 free bouncers.
# 'var' makes it mutable so we can subtract from it later.
var TrapsRemaining : int = 3
# A reference to a prop_spawner_device placed on the island in UEFN.
# We use a prop_spawner_device to handle the actual spawning,
# because Verse cannot call SpawnActor for arbitrary game props directly.
# Wire this device to a Bouncer Pad prop in the UEFN editor.
# note: Verse has no free SpawnActor for arbitrary props; prop_spawner_device
# is the supported way to spawn props at runtime in UEFN.
@editable
BouncerSpawner : prop_spawner_device = prop_spawner_device{}
# A reference to the button_device (or player_reference_device) that
# tells us which player triggered the gadget.
# Wire a trigger_device or item_granter_device's AgentActivates event
# to call DeployBouncer in your island setup.
@editable
GadgetTrigger : trigger_device = trigger_device{}
# This runs automatically when the island starts.
OnBegin<override>()<suspends> : void =
# Subscribe to the trigger so pressing it calls DeployBouncer.
GadgetTrigger.TriggeredEvent.Subscribe(OnUse)
# This event runs when the trigger fires (the player "presses" the gadget).
# It's like the trigger pull.
OnUse(Agent : agent) : void =
DeployBouncer(Agent)
# This is our FUNCTION. Think of it as the "Deploy" button logic.
# It receives the agent (player) who activated the gadget.
DeployBouncer(Agent : agent) : void =
# First, we check if we have any traps left.
# This is like checking your magazine before shooting.
if (TrapsRemaining > 0):
# Cast the agent to a fort_character so we can read their position.
if (Character := Agent.GetFortCharacter[]):
# Calculate where to spawn the trap.
# We take the player's current position and move it forward
# 200 units (≈ 2 metres). This uses Scene Graph coordinates.
PlayerTransform := Character.GetTransform()
PlayerLocation := PlayerTransform.Translation
ForwardVector := PlayerTransform.Rotation.GetLocalForward()
SpawnLocation := PlayerLocation + ForwardVector * 200.0
# Teleport the prop_spawner_device to the desired location
# then fire it — this is how UEFN positions spawned props.
# note: prop_spawner_device does not expose SetActorLocation in
# public API; reposition by moving the device in-editor or
# use a creative_prop reference for runtime placement.
BouncerSpawner.Spawn()
# Finally, subtract 1 from our ammo counter.
# The variable updates!
set TrapsRemaining -= 1
# Print a message to the output log for feedback.
Print("Bouncer Deployed! Charges left: {TrapsRemaining}")
else:
Print("No character body found — cannot deploy bouncer.")
else:
# The magazine is empty!
Print("Out of Bouncers! Reload needed.")
Walkthrough: What Just Happened?
var TrapsRemaining : int = 3: This is your Variable. It's a container for a number. Just like your shield bar holds a number (0-100), this variable holds the number of traps. We set it to3initially. Thevarkeyword marks it as mutable so thesetkeyword can change it later.DeployBouncer(Agent : agent) : void =: This is a Function. It's a block of code that does a specific job. We can call this function from anywhere. Here, we call it when the player uses the gadget.if (TrapsRemaining > 0):: This is a Conditional Statement. It's the game logic. If you have charges, then do the cool stuff. Else, tell the player they're out.BouncerSpawner.Spawn(): This is the magic word. It interacts with the Scene Graph through aprop_spawner_deviceyou wired up in the UEFN editor. The device knows which prop to create (your Bouncer Pad) and adds it to the game world at the device's location.set TrapsRemaining -= 1: This updates the variable. Every time you use the gadget, the number goes down. Verse requires thesetkeyword any time you write to avar—it's a deliberate signal that state is changing.
Try It Yourself
The gadget works, but it's a bit boring. It always spawns the bouncer directly in front. What if you want to make it harder?
Challenge: Modify the code so that the gadget only spawns a bouncer if the player is standing on a specific material type (like "Ice" or "Wood").
Hint: You'll need to use Character.GetTransform() to find the player's position, then perform a downward trace to see what surface is below them, and then check if that actor's tag or name matches what you want. This forces you to think about the Scene Graph hierarchy (Player -> Ground Actor -> Material).
Don't worry if you get stuck! The key is to break it down: First, get the ground actor. Second, check its name. Third, only spawn if it matches.
Recap
You've just built your first interactive system in Verse. You learned that:
- Variables are like your health bar or ammo count—they change during the game.
- Functions are like gadget abilities—they package actions into reusable blocks.
- The Scene Graph is the family tree of objects, and
BouncerSpawner.Spawn()adds new members to it at specific locations. - Conditionals (
if/else) are the logic that makes your island feel responsive and fair.
You're no longer just placing props. You're programming gameplay. Now go make some traps that actually hurt.
References
- https://dev.epicgames.com/documentation/en-us/fortnite/using-trap-items-in-fortnite-creative
- https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-trap-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/boulder-trap-gameplay-example-in-fortnite-creative
Verse source files
- 01-device.verse · device
Turn this into a guided course
Add using-trap-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.
References
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.