Spy School: Master the Disguise Device
Spy School: Master the Disguise Device
Do you want to play as a spy? Or maybe a robot? Or a snowman? You can change how you look in Fortnite! This makes your island super fun. You can hide in plain sight. You can trick your friends. Let's build a spy game together.
What You'll Learn
- What a Disguise Device is.
- How to give players a new look.
- How to make disguises break when players get hurt.
- How to write a tiny bit of Verse code.
How It Works
Imagine you are playing hide-and-seek. You hide behind a bush. You look like a bush! That is a disguise. In Fortnite, we use a special tool called a Device. A device is like a machine that does something.
The Disguise Device changes a player's outfit. It swaps their current look for a new one. Maybe they become a soldier. Maybe they become a ghost.
You can control this machine. You can tell it when to work. You can tell it who can use it. You can also tell it when the disguise should stop working. If a player gets hit, maybe they fall out of the disguise! This is called breaking the disguise.
We will use Verse to make this happen. Verse is the language we use to talk to Fortnite. Think of Verse as a recipe. You give the computer steps. It follows them.
Let's Build It
We will make a "Spy Trap." When a player steps on a button, they turn into a spy. If they get hit, they turn back to normal.
First, place a Disguise Device in your island. Find it in the Content Drawer. It is under Devices > Logic.
Next, pick an outfit. This is the Outfit ID. It is the name of the character skin. For example, "Outfit_Athena_Commando_F_Spy".
Now, we write some Verse code. This code tells the device what to do.
# This is the start of our script
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
# We create our game manager class
# A class holds all our code in one place
spy_trap_manager := class(creative_device):
# We connect to a Disguise Device placed in the island
# Tag this device in the editor by selecting it and setting its Tag
@editable
MyDisguise : disguise_device = disguise_device{}
# We connect to a Trigger Device so we know when a player steps on it
# Place a Trigger Device in the island and link it here in the editor
@editable
MyTrigger : trigger_device = trigger_device{}
# OnBegin runs automatically when the island starts
OnBegin<override>()<suspends> : void =
# Subscribe to the trigger so we know when a player enters
MyTrigger.TriggeredEvent.Subscribe(OnPlayerEnter)
# Subscribe to the disguise device's broken event
# This fires when the disguise is removed for any reason
MyDisguise.BreakDisguiseEvent.Subscribe(OnDisguiseRemoved)
# When a player steps on the trigger, apply the disguise
# This is the main action!
OnPlayerEnter(Agent : ?agent) : void =
if (ActualPlayer : player = player[Agent?]):
MyDisguise.ApplyDisguise(ActualPlayer)
Print("You are now a spy!")
# When the disguise is removed, let the player know
# The BreakDisguiseEvent fires when the disguise breaks,
# including when the player takes damage (set Break On Damage
# to true in the Disguise Device's properties in the editor)
OnDisguiseRemoved(Info : tuple(player, ?agent)) : void =
Print("Spy mode off!")```
### What Does This Code Do?
1. **`using /Fortnite.com/Devices`**: This line brings in the tools we need. It is like grabbing your toolbox.
2. **`spy_trap_manager := class(creative_device)`**: We create a new class that runs on the island. All our code lives inside it.
3. **`@editable MyDisguise : disguise_device`**: This is a slot in the editor. You drag your placed **Disguise Device** into this slot. The outfit ID is set directly on the device in the editor's property panel.
4. **`@editable MyTrigger : trigger_device`**: This is a slot for a **Trigger Device**. When a player walks on it, our code runs.
5. **`OnBegin`**: This runs as soon as the island starts. It tells the game to watch for events.
6. **`OnPlayerEnter`**: This is an **Event** handler. An event is something that happens in the game. When a player triggers the device, we call `Activate`. This gives them the spy look.
7. **`OnDisguiseRemoved`**: When the disguise is removed — including when the player takes damage, if **Break On Damage** is enabled in the editor — this handler fires. They look normal again.
## Try It Yourself
Can you make a robot disguise? Try these steps:
1. Find a robot outfit ID. You can look in the **Glossary** or ask a friend.
2. Select your **Disguise Device** in the editor and paste the outfit ID into its **Outfit ID** property field.
3. Change the message in `Print`. Make it say "Beep Boop!"
4. Test it in your island.
**Hint:** If the disguise doesn't work, check your spelling. The outfit ID must be exact. It is case-sensitive.
## Recap
You built a spy trap! You used the **Disguise Device** to change player looks. You used **Verse** to control it. You learned about **variables** and **events**. Great job! You are now a Fortnite creator.
## References
* https://dev.epicgames.com/documentation/en-us/fortnite/using-disguise-devices-in-fortnite
* https://dev.epicgames.com/documentation/en-us/fortnite/36-10-fortnite-ecosystem-updates-and-release-notes
* https://dev.epicgames.com/documentation/en-us/fortnite/squid-game-deception-through-disguises-in-unreal-editor-for-fortnite
* https://dev.epicgames.com/documentation/en-us/fortnite/using-disguise-items-in-fortnite-creative
* https://dev.epicgames.com/documentation/fortnite/verse-api/fortnitedotcom/devices/disguise_device
Verse source files
- 01-device.verse · device
Turn this into a guided course
Add using-disguise-devices-in-fortnite 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.