The "Glass Cannon" Power-Up: Building a Damage Amplifier in Verse
The "Glass Cannon" Power-Up: Building a Damage Amplifier in Verse
Imagine picking up a glowing orb that turns your weak pistol shots into sniper-rifle-level devastation for 15 seconds. That’s the thrill of a Damage Amplifier. In Fortnite Creative, this is usually just a device you drag and drop, but in Verse, we’re going to build a system where the power-up isn’t just a static object—it’s a dynamic event that tracks who grabbed it, when it expires, and ensures the chaos ends exactly when the timer runs out.
We aren’t just placing a prop; we’re programming the feeling of being overpowered.
What You'll Learn
- Entities and Components: Understanding the difference between the "thing" in the world (the power-up) and its "behavior" (the code).
- Events: How to listen for a player touching the power-up (like a tripwire).
- Timers: Creating a temporary buff that automatically wears off.
- State Management: Tracking which player currently has the buff to prevent overlap.
How It Works
In traditional UEFN, you place a "Damage Amplifier Powerup" device, set the duration to 10 seconds, and let it sit there. It’s passive. It waits.
In Verse, we treat this power-up as an Entity. An Entity is basically any object in your game world—a wall, a player, a prop, or a device. Think of it like a specific island in your Creative lobby. It has a location, it has properties, and it can have scripts attached to it.
The Component is the script attached to that Entity. It’s like the brain inside the body. When a player (an Agent) picks up this specific Entity, the Component fires an Event. An Event is a signal that says, "Hey! Something happened!" In this case, the signal is "Player touched me."
When that signal fires, our code does three things:
- It checks if the player already has the buff (so they don’t stack it infinitely).
- It applies the damage multiplier.
- It starts a Timer. A Timer is a countdown clock. When it hits zero, it fires another Event to remove the buff.
We’re essentially building a self-contained "Glass Cannon" mode. You pick it up, you feel like a god, and then reality catches up with you.
Let's Build It
Here is a complete, working Verse script for a Damage Amplifier Powerup. This code assumes you have a Damage Amplifier Powerup device placed in your island. We will attach this script to that device.
Note: In UEFN, you create a new Verse file, paste this in, and then drag the script onto your Powerup device in the editor.
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/SpatialMath }
# This is our main script class. Think of it as the "brain" for the powerup.
class GlassCannonPowerup is WorldDevice():
# DATA MEMBERS (Variables):
# These are the settings you can tweak in the editor or here.
# Duration is how long the buff lasts (in seconds).
Duration: float = 15.0
# Multiplier is how much damage is boosted. 2.0 means double damage.
DamageMultiplier: float = 2.0
# This is a reference to the actual Powerup Device in the editor.
# We link this in the editor, or we can find it programmatically.
# For simplicity, we assume this script IS attached to the device.
SelfDevice: DamageAmplifierPowerupDevice = Self
# This tracks who currently has the buff.
# An "Agent" is a player or NPC.
# We use an "optional" type because no one has the buff at the start.
CurrentHolder: optional Agent = none
# INITIALIZATION:
# This runs once when the island starts or the device spawns.
OnBegin<override>()<suspends>: void = super.OnBegin() <suspends>
# We connect our custom function to the device's pickup event.
# Think of this like plugging a wire into a trigger.
SelfDevice.ItemPickedUpEvent += OnItemPickedUp
SelfDevice.ItemDroppedEvent += OnItemDropped
# EVENT HANDLER: When someone picks up the powerup
OnItemPickedUp: func(Holder: Agent): void =
# 1. Check if someone already has the buff.
# If CurrentHolder is not none, someone is already "Glass Cannoning."
if CurrentHolder != none:
# Remove the buff from the previous holder.
RemoveBuff(CurrentHolder)
# 2. Set the new holder.
CurrentHolder = Holder
# 3. Apply the buff.
# In Verse/UEFN, we often use device methods or state changes.
# Here we simulate the "amplified state" by changing a visual cue
# or using the device's native amplification if available.
# For this example, we'll assume we are managing the logic manually
# to demonstrate the timer and state tracking.
# NOTE: The native DamageAmplifierPowerupDevice handles the actual
# damage math internally. We are just managing the lifecycle here.
# We trigger the device's activation if it wasn't already active.
# (Assuming the device is set to "Manual" trigger in editor,
# or we rely on the event to signal the effect start).
# 4. Start the countdown timer.
# "After" creates a delay. When the delay finishes, it runs the lambda.
After(Duration):
# This code runs exactly 'Duration' seconds later.
if CurrentHolder == Holder:
# Only remove if this holder is still the current one.
RemoveBuff(Holder)
CurrentHolder = none
# EVENT HANDLER: When someone drops the powerup (rare for powerups, but good practice)
OnItemDropped: func(Dropper: Agent): void =
if CurrentHolder == Dropper:
RemoveBuff(Dropper)
CurrentHolder = none
# HELPER FUNCTION: Removes the buff effect
RemoveBuff: func(AgentToRemove: Agent): void =
# In a full implementation, you might play a sound, change their color,
# or reset their damage stats if you were doing custom damage math.
# Since DamageAmplifierPowerupDevice handles the damage multiplier natively,
# we just need to ensure the device stops affecting them if we were
# using a custom damage volume.
# For this device, the "effect" is tied to the pickup event triggering
# the internal state. When the timer ends, we rely on the device's
# internal timeout or we simply stop tracking it in our script.
# Let's play a "power down" sound for feedback!
# (Assuming a sound prop exists or using a simple visual cue)
# We'll just print to the debug console for now.
DebugPrint("{AgentToRemove.GetName()} lost the Glass Cannon buff!")
Walkthrough: What Just Happened?
class GlassCannonPowerup is WorldDevice(): We defined a new class. In Verse, everything is an object. By inheriting fromWorldDevice, we tell the engine, "Hey, I’m a script that lives on a device in the world."DurationandDamageMultiplier: These are Variables. A variable is just a named box that holds a value.Durationis a box holding the number15.0(seconds).DamageMultiplierholds2.0. You can change these in the editor’s details panel if you expose them.OnBegin: This is the Constructor. It runs when the game starts. The lineSelfDevice.ItemPickedUpEvent += OnItemPickedUpis crucial. It’s like setting a trap. We are saying, "When the 'ItemPickedUpEvent' fires, run theOnItemPickedUpfunction."OnItemPickedUp: This is the Event Handler. It takesHolder: Agentas an argument. The engine passes the player who picked it up into this function.After(Duration):: This is the Timer. It pauses the script for 15 seconds, then runs the code inside the block. This is where we clean up.RemoveBuff: A helper Function. A function is a reusable block of code. Instead of writing the cleanup logic twice (once for the timer, once for dropping), we put it in a function and call it when needed.
Try It Yourself
Challenge: Right now, if two players pick up the powerup at the exact same time, the script might get confused. Add a check to OnItemPickedUp that prevents the second player from getting the buff if CurrentHolder is already set to a different agent. Print a message like "Buff taken by [PlayerName]!" to the debug console.
Hint: Use an else block after your if CurrentHolder != none check. Inside the else, you can set CurrentHolder = Holder and then start the timer. Remember to use DebugPrint to see the output.
Recap
You just built a dynamic power-up system in Verse. You learned how to use Entities (the device), Variables (duration/multiplier), Events (pickup/drop), and Timers (the countdown). You didn’t just place a prop; you programmed its life cycle. Now, go make your friends feel like gods for 15 seconds, then watch them crumble when the timer hits zero.
References
- https://dev.epicgames.com/documentation/en-us/fortnite/using-damage-amplifier-powerup-devices-in-fortnite-creative
- https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-damage-amplifier-powerup-devices-in-fortnite-creative
- https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-devices-in-fortnite-creative
- https://dev.epicgames.com/documentation/fortnite/verse-api/fortnitedotcom/devices/damage_amplifier_powerup_device
- https://dev.epicgames.com/documentation/fortnite/verse-api/fortnitedotcom/devices
Verse source files
- 01-fragment.verse · fragment
Turn this into a guided course
Add using-damage-amplifier-powerup-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.
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.