How to Build a Master Alert Switch in Fortnite Creative
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.
How to Build a Master Alert Switch in Fortnite Creative
Have you ever played a game where one bad move wakes up all the enemies? It is like a silent alarm that rings for everyone. We will build this system today. You will learn how to control the "alert" level of your island. It is like a master remote for danger.
What You'll Learn
- What a Master Switch is.
- How to connect devices using Events.
- How to hide a switch so players cannot see it.
- How to check if a switch is On or Off.
How It Works
Think of a Master Switch like a main power button. When it is On, everything connected to it works. When it is Off, nothing works. In Fortnite Creative, we use this for alerts.
Imagine you are a spy. You need to sneak past guards.
- The Master Switch is the "Sneak Mode" button.
- When you turn it On, the guards start listening.
- When you turn it Off, the guards go back to sleep.
We do not want players to see this button. It should be hidden. We also want other devices to react to it. For example, a sound effect should play when the switch turns On. This is called an Event. An Event is like a domino falling. One thing happens, and it pushes the next thing.
In Verse, we write code to link these events. We tell the game: "When the switch turns On, play this sound." This makes your island feel smart and alive.
Let's Build It
We will build a simple system.
- A hidden Master Switch.
- A visible "Test Switch" that players can touch.
- A Text Label that shows "ALERT ON" or "ALERT OFF".
Here is the Verse code to make it work. Copy this into your Verse file.
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
# This is our main script block
alert_system := class(creative_device):
# We store references to our devices here.
# This is like giving them nicknames.
@editable
MasterSwitch : switch_device = switch_device{}
@editable
TestSwitch : switch_device = switch_device{}
@editable
AlertLabel : text_block_device = text_block_device{}
# This function runs when the script starts.
OnBegin<override>()<suspends> : void =
# Subscribe to the Test Switch events.
# When a player turns it on, call OnTestSwitchTurnedOn.
# When a player turns it off, call OnTestSwitchTurnedOff.
TestSwitch.TurnedOnEvent.Subscribe(OnTestSwitchTurnedOn)
TestSwitch.TurnedOffEvent.Subscribe(OnTestSwitchTurnedOff)
# Start with the Alert OFF.
MasterSwitch.TurnOff()
UpdateLabelText(false)
# This function updates the text on the screen.
# It checks the Master Switch state via a bool we pass in.
UpdateLabelText(IsOn : logic) : void =
if (IsOn?):
# If IsOn is true, the switch is ON.
AlertLabel.SetText(StringToMessage("ALERT: ON"))
else:
# If IsOn is false, the switch is OFF.
AlertLabel.SetText(StringToMessage("ALERT: OFF"))
# This event happens when the Test Switch is turned On.
# It forces the Master Switch to turn On too.
OnTestSwitchTurnedOn(Agent : agent) : void =
# Turn the master switch on to match.
MasterSwitch.TurnOn()
# Update the text label.
UpdateLabelText(true)
# This event happens when the Test Switch is turned Off.
# It forces the Master Switch to turn Off too.
OnTestSwitchTurnedOff(Agent : agent) : void =
# Turn the master switch off to match.
MasterSwitch.TurnOff()
# Update the text label.
UpdateLabelText(false)
Walkthrough
Let's look at the code part by part.
1. Storing Devices
We create variables for our devices.
MasterSwitch : switch_device = switch_device{}
This tells Verse we have a switch device. We will use this name later. The @editable tag lets us assign the real device from the UEFN editor.
2. Hiding the Master
In UEFN, select your Master Switch device and set its Visible In Game property to Off in the Details panel. The switch_device API does not expose a runtime visibility method, so we control visibility through the device's editor properties instead.
3. The Logic
if (IsOn?):
This checks if the logic value IsOn is true. We pass true when the switch turns On and false when it turns Off, then display the matching message.
4. Updating the Label
We use SetText() to change the words on the screen.
StringToMessage() converts a plain string into the message type that SetText() requires.
If the switch is On, we write "ALERT: ON".
If the switch is Off, we write "ALERT: OFF".
5. Connecting the Events
We use Subscribe() to link events directly in Verse code.
TestSwitch.TurnedOnEvent.Subscribe(OnTestSwitchTurnedOn)means: "when a player turns the Test Switch on, runOnTestSwitchTurnedOn."TestSwitch.TurnedOffEvent.Subscribe(OnTestSwitchTurnedOff)means: "when a player turns it off, runOnTestSwitchTurnedOff."
You no longer need to wire events manually in the UEFN UI. The code does it for you!
Try It Yourself
Can you make the Master Switch change color?
- Add a Prop Mover or a Light to your island.
- Make it turn Red when the Alert is ON.
- Make it turn Green when the Alert is OFF.
Hint: Use the UpdateLabelText() function. Add a line inside the if block to turn the light On. Add a line inside the else block to turn the light Off.
Recap
You built a Master Alert Switch system!
- You hid a switch so players could not see it.
- You linked a visible switch to control the hidden one.
- You used Verse to check the state and update text.
Great job! You are now a sneaky island designer. Keep building!
References
- https://dev.epicgames.com/documentation/en-us/fortnite/yacht-heist-2-the-guard-alert-system-in-fortnite-creative
- https://dev.epicgames.com/documentation/en-us/fortnite-creative/build-patchwork-x-yacht-heist-2-guard-alert-system-in-fortnite-creative
- https://dev.epicgames.com/documentation/en-us/fortnite/lock-device-design-examples
- https://dev.epicgames.com/documentation/en-us/uefn/verse-api/fortnitedotcom/devices/conditional_button_device
- https://dev.epicgames.com/documentation/en-us/fortnite/using-switch-devices-in-fortnite-creative
Verse source files
- 01-device.verse · device
Turn this into a guided course
Add Master Alert Switch 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.