The "Don't Touch the Lava" Trap: Building Your First Verse Script
Tutorial beginner

The "Don't Touch the Lava" Trap: Building Your First Verse Script

Updated beginner

The "Don't Touch the Lava" Trap: Building Your First Verse Script

Remember that feeling when you accidentally step into a pit of lava in a survival game and instantly lose half your health? It’s instant, it’s fair, and it’s annoying. Now, imagine you’re the one holding the match.

In this tutorial, we’re going to build a "Revenge Spire." It’s a simple tower with a hidden trapdoor. When players climb to the top, they expect loot. Instead, they get a Verse script that detects their presence and drops them into the void. We’ll use the Damage Volume device, but instead of just placing it and hoping for the best, we’re going to control it with code. This is your first step into Verse: making game objects react to the world instead of just sitting there.

What You'll Learn

  • Variables: How to store settings (like damage amount) so you can tweak them without breaking the game.
  • Events: How to listen for "when a player enters this zone."
  • The Scene Graph: Understanding how your script "talks" to the physical device you placed in the editor.
  • Verse Syntax: Basic structure for a functional script.

How It Works

Before we write a single line of code, let’s look at the Damage Volume device. Think of it like a Storm Circle or a Lava Pit. It’s an invisible 3D box floating in the world. Anything inside that box takes damage.

In standard Fortnite Creative, you place the device, set the damage to 100, and boom—anyone touching it dies. It’s static. It doesn’t care who touches it or when.

Verse changes the rules. Instead of the device doing the work automatically, the device becomes a tool that your script controls. You can make the trap only trigger after 5 minutes, or only if the player is holding a specific weapon, or (in our case) only if they reach the top of the spire.

Here is the game mechanic analogy for the code we’re about to write:

  • The Script: The Game Designer in your head.
  • The Damage Volume: The trapdoor mechanism.
  • The Event (On Agent Enters): The sensor that says "Hey Designer, someone is in the pit!"
diagram

Verse turns a static volume into a controlled trap: an enter-event drives a deliberate DealDamage call.

Let's Build It

We are going to build a script called RevengeSpire. It will listen for players entering a specific zone and then apply damage.

Step 1: Place the Device

  1. Open UEFN.
  2. Place a Damage Volume device.
  3. Scale it up so it covers the top platform of your tower.
  4. Crucial Step: In the device options, set Damage to 0. Why? Because we want our code to handle the damage, not the device itself. If the device does damage, our script might double-count it, and nobody wants a double-elimination glitch.

Step 2: The Verse Script

Create a new Verse file (right-click in the Content Browser -> New -> Verse File). Name it RevengeSpire.

Paste this code in. Don’t panic—let’s break it down line by line.

Walkthrough: What Just Happened?

  1. using { /Fortnite.com/Devices }: This is your Inventory. Just like you need to grab a pickaxe to mine, you need this line to access device functions like DealDamage. Without it, Verse doesn’t know what a DamageVolume is.
  2. template RevengeSpireDevice : ISimpleScript: This defines the Class. In game terms, think of this as the "Type" of device. You’re telling Verse, "I am creating a new kind of script that follows the rules of a simple script."
  3. TargetVolume: DamageVolume: This is a Variable (specifically, a reference). In Fortnite, you might have a "Player Spawner" device. Here, we’re saying, "This script expects a Damage Volume to be plugged into it." It’s like saying, "This trapdoor needs a spring mechanism."
  4. DamageAmount: int = 50: This is a Constant (or a configurable variable). int stands for "integer," which is just a fancy word for a whole number (no decimals). We set it to 50. This is like setting the "Storm Damage" in the Game Settings. You can change this number in the editor, and the script will use the new value.
  5. OnAgentEntered(Agent: agent) -> void: This is the Event. In Fortnite, you have "Trigger" devices that activate when someone walks on them. This function is the code version of that trigger. Verse automatically calls this function whenever an Agent (player) steps into the TargetVolume.
  6. TargetVolume.DealDamage(Agent, DamageAmount): This is the Function Call. It’s the actual action. You’re telling the TargetVolume device: "Hey, deal DamageAmount damage to Agent."

Try It Yourself

Now that you have the basic script, try these challenges to make it more interesting. Hint: You might need to look up other functions in the Verse API, but you can also try modifying the existing code!

Challenge 1: The "Ouch" Factor Change the DamageAmount to 100. What happens when a player steps in? Does it feel more punishing? Now try setting it to 10. Does it feel like a minor annoyance?

Challenge 2: The "No-Clip" Glitch In the RevengeSpireDevice template, add a new variable called IsInvulnerable: bool = false. Then, inside OnAgentEntered, add an if statement: if (IsInvulnerable == true) { return }. What does this do? It makes the script skip the damage if the flag is true. Can you think of a gameplay reason to have an invulnerability flag? (Hint: Think about power-ups or invincibility frames after respawning).

Challenge 3: The "Announcement" Can you make the script print a message to the chat when someone gets hit? Look up the SendChatMessage function in the Verse documentation for devices. You’ll need to add World: World to your template inputs to access game-wide functions.

Recap

You just built your first interactive system in Verse. You learned that:

  1. Devices are the physical objects in the world (like the Damage Volume).
  2. Scripts are the brains that control those devices.
  3. Variables store settings (like damage amount).
  4. Events (like OnAgentEntered) let your script react to player actions.

You didn’t just place a trap; you programmed the logic behind it. That’s the power of Verse. Now go make some players regret stepping on your platform.

References

  • https://dev.epicgames.com/documentation/en-us/fortnite/using-damage-volume-devices-in-fortnite-creative
  • https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-damage-volume-devices-in-fortnite-creative
  • https://dev.epicgames.com/documentation/en-us/fortnite/damage-volume-design-examples-in-fortnite
  • https://dev.epicgames.com/documentation/en-us/fortnite-creative/down-but-not-out-device-design-example
  • https://dev.epicgames.com/documentation/fortnite/verse-api/fortnitedotcom/devices/damage_volume_device

Get the complete code — free

You've read the full walkthrough. The complete, copy-paste-ready Verse solution is free for members — sign in to unlock it.

Free with your BrainDead.TV / BrainDeadGuild Discord account. The walkthrough above is always free.

Verse source files

Turn this into a guided course

Add using-damage-volume-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