Boom! Make a Ticking Time Bomb 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.
Boom! Make a Ticking Time Bomb with Verse
Do you want to build a trap that counts down before it explodes? Or maybe a barrel that warns you before it blows up? You can do this with Verse!
We will make a simple time bomb. It will tick for three seconds. Then it will boom! You will learn how to link devices together. You will also learn how to use code to wait for time. This is super fun. Let's get started!
What You'll Learn
- How to place an Explosive device.
- How to use a Timer to wait.
- How to write a small Verse script to connect them.
- How to test your explosion safely.
How It Works
Think of your island like a toy train set. Each device is a train car. The Explosive device is the last car. It does the big boom. The Timer is the engine. It starts the movement.
We need a conductor. That conductor is our Verse script. The script says: "Wait three seconds. Then tell the Timer to start." The Timer says: "Okay, I will wait. Then I will tell the Explosive to boom."
This chain of commands is called an Event. An event is like a domino falling. One thing hits another. Then another. Then BOOM!
We will use a special tool called a VFX Creator. This adds a cool visual effect. It makes the bomb glow red before it explodes. This warns players! It is like a ticking clock sound.
Let's Build It
First, place these devices in your island:
- One Explosive device.
- One Timer device.
- One VFX Creator device.
- One Trigger device (this starts everything).
Now, we need to add the Verse code. Click on the Trigger device. Then click "Add Verse" or "Edit Code." Paste this code in.
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
# This is our main script block
# It lives inside a Verse device linked to your island
my_bomb_device := class(creative_device):
# Drag each device into these properties in the UEFN details panel
@editable
TriggerDevice : trigger_device = trigger_device{}
@editable
TimerDevice : timer_device = timer_device{}
@editable
VFXDevice : vfx_creator_device = vfx_creator_device{}
@editable
ExplosiveDevice : explosive_device = explosive_device{}
# OnBegin runs automatically when the island session starts
OnBegin<override>()<suspends> : void =
# Subscribe to the trigger so we know when a player steps on it
TriggerDevice.TriggeredEvent.Subscribe(OnBombTriggered)
# This function runs when someone steps on the trigger
OnBombTriggered(Agent : ?agent) : void =
# First, we change the VFX to show a warning
# This makes the bomb glow red
VFXDevice.Begin()
# Next, we tell our script to wait for 3 seconds
# Then we tell the Explosive to explode
# We spawn a new async task so the rest of the island keeps running
spawn{ CountdownAndExplode() }
# This suspends (waits) for 3 seconds, then triggers the explosion
CountdownAndExplode()<suspends> : void =
# Wait for 3 seconds — change 3.0 to 1.0 to make it faster!
Sleep(3.0)
# Tell the explosive device to explode
ExplosiveDevice.Explode()```
### Walkthrough of the Code
Let's look at the code line by line.
`my_bomb_device := class(creative_device):`
This line names our script. Think of it like naming a toy. We call it `my_bomb_device`. This helps us find it later. It extends `creative_device` so UEFN knows it belongs in your island.
`OnBegin<override>()<suspends> : void`
This is a special function that runs automatically when your island starts. It tells Verse to watch the trigger. When the trigger fires, call `OnBombTriggered`.
`OnBombTriggered(Agent : agent) : void`
This is a **function**. A function is a set of instructions. This one runs when a player touches the trigger. `Agent : agent` means "who touched it?" It is the player.
`VFXDevice.Play()`
This line tells the VFX Creator to play its effect. We assigned the VFX device in the details panel as `VFXDevice`. It makes the visual warning appear.
`Sleep(3.0)`
This waits for three seconds. `3.0` means three seconds. The script pauses here while the clock counts down.
`ExplosiveDevice.Explode()`
This fires after the wait is over. It tells the Explosive device to go boom!
### Connecting the Devices
The code above handles everything from start to finish. But you must still assign your devices in the UEFN details panel.
1. Select your **Verse device** in the UEFN outliner.
2. In the **Details** panel, find `TriggerDevice`, `TimerDevice`, `VFXDevice`, and `ExplosiveDevice`.
3. Drag each matching island device into its slot.
Now the chain is complete!
1. Player steps on Trigger.
2. Code plays VFX (glow).
3. Code waits 3 seconds with `Sleep`.
4. 3, 2, 1...
5. Code calls `Explode()` on the Explosive.
6. Explosive goes BOOM!
## Try It Yourself
Can you make the bomb explode faster? Try changing the number `3.0` in the code to `1.0`. What happens?
Also, try adding more VFX effects. Can you make it glow blue instead of red? Look at the VFX Creator settings to change the color.
**Hint:** Remember to save your island before you play! Testing explosions can destroy your build if you are not careful.
## Recap
You just built a working time bomb! You used an **Explosive** device for the boom. You used `Sleep` in **Verse** for the wait. You used **Verse** code to start it all. You also used a **VFX Creator** for the warning glow.
This is how game makers think. They break big ideas into small steps. Then they connect the steps. You are now a game maker! Keep building and keep coding.
## References
- https://dev.epicgames.com/documentation/en-us/fortnite/using-explosive-items-in-fortnite-creative
- https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-explosive-consumables-in-fortnite-creative
- https://dev.epicgames.com/documentation/en-us/fortnite/explosive-device-design-example-in-fortnite-creative
- https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-explosive-devices-in-fortnite-creative
- https://dev.epicgames.com/documentation/en-us/fortnite/using-explosive-devices-in-fortnite-creative
Verse source files
- 01-device.verse · device
Turn this into a guided course
Add using-explosive-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.