The Magic of Waiting: Making Platforms Disappear
The Magic of Waiting: Making Platforms Disappear
Do you like building secret bases? Do you like traps that only work sometimes? Today, we will make a disappearing platform. It will vanish when you step on it. Then it will come back after a short wait. This wait is called a cooldown. It is like a video game power-up that needs time to recharge.
What You'll Learn
- How to make a platform hide and show up.
- How to use a variable to store a number.
- How to use Sleep to pause the game for a moment.
- How to connect devices using Verse.
How It Works
Imagine a trapdoor in a castle. You step on it. It falls down. You cannot walk on it for ten seconds. After ten seconds, it pops back up.
In Fortnite, we use a device called a Trick Tile. It can hide or show a platform. But we need a brain to tell it when to hide and when to show. That brain is Verse.
We need two things in our brain:
- A Variable: This is like a box. We put the number
2.0in it. This means "wait 2 seconds." - A Loop: This is like a merry-go-round. It goes round and round forever.
The code will do this:
- Wait for you to touch the tile.
- Hide the platform.
- Wait for the time in the box (2 seconds).
- Show the platform again.
- Go back to step 1.
Let's Build It
First, place a Trick Tile in your island. Place a Prop on top of it. This prop is your platform.
Now, let's write the code. Copy this into a new Verse file.
# We need the Trick Tile device tools
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
# This is the main script for our island
MyIsland := class(creative_device):
# This is our Trick Tile device.
# Drag your Trick Tile from the editor onto this property.
@editable
TrickTile : trick_tile_device = trick_tile_device{}
# This is our "brain" that starts when the game begins
OnBegin<override>()<suspends>:void=
# We create a variable called 'wait_time'
# It holds the number 2.0 (seconds)
wait_time := 2.0
# We start a forever loop
loop:
# We wait for a player to touch the tile
TrickTile.ActivatedEvent.Await()
# When touched, we hide the tile
TrickTile.Disable()
# We wait for the time in our variable
Sleep(wait_time)
# Then we show the tile again
TrickTile.Enable()```
### Walkthrough
1. `wait_time := 2.0`: This creates a box. We put `2.0` inside. This is our **variable**. It changes if we edit the number.
2. `Sleep(wait_time)`: This is the magic pause button. The game stops for exactly the number of seconds in our box.
3. `loop:`: This starts the cycle. It never ends. It keeps checking for players.
## Try It Yourself
Can you make the platform wait longer? Try changing the number `2.0` to `5.0`.
**Hint:** Find the line that says `wait_time := 2.0`. Change the `2.0` to `5.0`. Save your code. Play the island. Does it wait longer?
## Recap
You built a looping trap! You used a **variable** to store time. You used **Sleep** to pause the action. You used a **loop** to keep the game running. Great job, coder!
## References
* https://dev.epicgames.com/documentation/en-us/uefn/disappearing-platform-on-loop-using-verse-in-unreal-editor-for-fortnite
* https://dev.epicgames.com/documentation/en-us/fortnite/disappearing-platform-on-loop-using-verse-in-unreal-editor-for-fortnite
* https://dev.epicgames.com/documentation/en-us/fortnite/verse-api/fortnitedotcom/devices/nitro_hoop_device/setcooldowndelay
* https://dev.epicgames.com/documentation/fortnite/verse-api/fortnitedotcom/devices/nitro_hoop_device/setcooldowndelay
* https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-trick-tile-devices-in-fortnite-creative
Verse source files
- 01-device.verse · device
Turn this into a guided course
Add Wait for ToggleDelay seconds. 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.