Hire Your First Digital Bodyguard
Hire Your First Digital Bodyguard
Have you ever wished you had a friend to help you fight in a game? In Fortnite Creative, you can hire AI guards! They act like loyal soldiers. They will follow you and shoot at enemies. This tutorial shows you how to build a hireable guard. You will learn how to spawn them and give them a job. It is like hiring a helper for your island.
What You'll Learn
- How to place a Guard Spawner device.
- How to set up the Scene Graph for your guard.
- How to use Verse code to hire the guard.
- How to make the guard fight for you.
How It Works
Think of a Guard Spawner like a vending machine. You put a coin in. The machine gives you a guard. But the guard needs to know who to help. We use Verse code to tell the guard, "Help this player!"
In Fortnite, everything is part of a Scene Graph. This is just a fancy name for a family tree of objects. Your player is one branch. Your guard is another branch. The Guard Spawner is the parent. It holds the guard until you are ready.
When you hire a guard, two things happen. First, the guard appears. Second, the guard joins your team. They will now attack anyone who attacks you. This is called teamwork. We make this happen with a simple command called Hire.
Let's Build It
We will build a simple room. You will spawn inside. You will see a guard spawner. When you touch it, the guard appears and helps you.
Step 1: Build the Room
- Open UEFN.
- Build a small square room. Make it 10x10 tiles.
- Add a door so you can enter.
- Place a Player Spawner inside the room.
- Place a Guard Spawner next to the player spawner.
Step 2: Configure the Guard Spawner
Click on the Guard Spawner. Look at the Details panel. Change these settings:
- Can Be Hired: Set to Yes. This lets players hire the guard.
- Number of Guards: Set to 1. We only want one helper.
- Team: Set to Team 1. This matches the player's team.
- Spawn Timer: Set to 1 Second. This adds a short delay.
- Patrol Option: Set to Disable Patrol. The guard will stay still until hired.
Step 3: Add the Verse Code
Now we add the magic. We need to tell the game what to do when the player hires the guard.
Create a new Verse file. Name it GuardHelper.verse. Paste this code in:
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
# This is our main script
Guard_Hire_Script := class(creative_device):
# This connects to your Guard Spawner device
@editable
My_Guard_Spawner : guard_spawner_device = guard_spawner_device{}
# This runs when the game starts
OnBegin<override>()<suspends> : void =
# Now, listen for the hire event
# When a player hires, this code runs
My_Guard_Spawner.HiredEvent.Subscribe(On_Guard_Hired)
# This function handles the hiring
On_Guard_Hired(Result : device_ai_interaction_result) : void =
# 'Result' contains info about the interaction, including the player who hired the guard
# We tell the spawner to hire this specific guard for this player
if (Instigator := Result.Source?):
My_Guard_Spawner.Hire(Instigator)
# Optional: You can print a message here
# Print("Guard hired by player!")```
### How the Code Works
* `using { /Fortnite.com/Devices }`: This line brings in the tools for devices. It is like opening a toolbox.
* `My_Guard_Spawner`: This is a **variable**. It stores the link to your Guard Spawner device.
* `OnBegin<override>()`: This runs when the level loads. We use it to set things up.
* `HiredEvent.Subscribe()`: This listens for a signal. It waits for a player to hire the guard.
* `Hire(Instigator)`: This is the key command. It tells the guard, "Join this player's team!" The `Instigator` is the player who did the hiring.
### Step 4: Connect the Code
1. Go back to your level.
2. Select the Guard Spawner device.
3. In the **Details** panel, find the **Verse** section.
4. Drag your `Guard_Hire_Script` into the **Script** slot.
5. Drag the Guard Spawner into the **My_Guard_Spawner** slot.
### Step 5: Play Your Island
1. Press **Play**.
2. Walk up to the Guard Spawner.
3. Interact with it (usually the E key or the action button).
4. Watch the guard appear!
5. Now, shoot at an enemy. The guard will shoot back.
## Try It Yourself
You did it! You hired your first guard. Now, try this challenge:
**Challenge:** Make the guard disappear after 10 seconds.
**Hint:** Look for a function called `Set_Guards_Not_Hireable` or check the `Despawn_Guards_When_Disabled` setting on the device. Can you use a timer to disable the spawner after 10 seconds?
## Recap
You learned how to hire a guard in Fortnite Creative. You used a **Guard Spawner** device. You wrote Verse code to connect the player to the guard. The `Hire` command made the guard join your team. This is a great start for making smart AI helpers on your island. Keep building!
## References
* https://dev.epicgames.com/documentation/en-us/fortnite/using-guard-spawner-devices-in-fortnite-creative
* https://dev.epicgames.com/documentation/fortnite/verse-api/fortnitedotcom/devices/guard_spawner_device/hire
* https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-guard-spawner-devices-in-fortnite-creative
* https://dev.epicgames.com/documentation/fortnite/verse-api/fortnitedotcom/devices/guard_spawner_device
* https://dev.epicgames.com/documentation/en-us/fortnite/using-ai-patrol-path-node-devices-in-fortnite-creative
Verse source files
- 01-device.verse · device
Turn this into a guided course
Add Guard Hire 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.