Make Your Characters Glow!
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.
Make Your Characters Glow!
Do you want players to know who is who on your Fortnite island? Maybe you want your heroes to glow green and the bad guys to glow red. In this tutorial, we will make characters shine with light. This is called a "Visual Aid." It helps everyone play better. You will write Verse code to change how things look.
What You'll Learn
- What a Visual Aid is in game design.
- How to change a character's Material (the skin or paint on a 3D object).
- How to use Events to react when a player joins.
- How to make your code run in the background.
How It Works
Imagine you are at a party. Some people wear red shirts. Some wear blue shirts. You can tell who is on which team instantly. This is a visual aid. It gives clues without words.
In Verse, we use Materials to change colors. A Material is like a sticker for your character. We can swap the sticker to change the color.
We need two things to make this work. First, we need to know when a player arrives. We use an Event. An Event is like a doorbell. When someone walks in, the bell rings. Our code hears the ring.
Second, we need to change the look. We will find the player's character model. Then we will apply a new Material. This makes them glow. We will use a special trick called Spawning. Spawning lets us run a task quietly. It does not stop the rest of the game.
Let's build a simple team system. Team A will glow blue. Team B will glow red.
Let's Build It
We will create a script that watches for players. When a player joins, the script picks a color. Then it paints the player.
Here is the code. Copy it into your Verse editor.
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Symbols as Engine }
# This is our main script. It runs on the island.
TeamVisuals := class(VerseWorld):
# This runs when the game starts.
OnBegin<override>()<suspends>:
# We watch for players joining the game.
# The 'For' loop checks every player slot.
For Player : Player in World.GetPlayers():
# We start a background task for this player.
Spawn ChangePlayerColor(Player)
# This function changes the color.
# It takes a Player as input.
ChangePlayerColor(Player : Player):
# We find the player's character mesh.
# This is the 3D model of their body.
Mesh := Player.GetMesh()
# We check if the mesh exists.
If Mesh:
# We pick a color based on the player ID.
# Even IDs get Blue. Odd IDs get Red.
Color := If Player.GetId() % 2 == 0,
Engine.LinearColor{R:0.0, G:0.0, B:1.0, A:1.0},
Engine.LinearColor{R:1.0, G:0.0, B:0.0, A:1.0}
# We apply the color to the material.
# This makes the character glow!
Mesh.SetMaterial(0, Color)
Code Walkthrough
OnBegin: This is the start button. It runs once when the map loads.World.GetPlayers(): This gets a list of everyone in the game.Spawn: This is the magic word. It says, "Run this code later, don't wait." This keeps the game smooth.Player.GetMesh(): This finds the body of the player. Think of it like finding the doll inside the box.SetMaterial: This changes the skin of the doll. We pass in a Color. A Color has Red, Green, Blue, and Alpha (opacity).
Try It Yourself
Can you make the colors flash? Right now, they are steady. Try adding a Loop. A Loop repeats code over and over.
Hint: Use a For loop inside ChangePlayerColor. Change the color to White for a split second, then back to the team color. Use Wait to pause between changes.
Recap
You just made a visual aid! You learned how to detect players. You learned how to change their colors. You used Spawn to keep things running fast. Now your island has clear team colors. Great job!
References
- https://dev.epicgames.com/documentation/en-us/uefn/triad-infiltration-9-creating-visual-aids-in-verse
- https://dev.epicgames.com/documentation/en-us/uefn/triad-infiltration-in-verse
- https://dev.epicgames.com/documentation/en-us/uefn/create-your-own-device-in-verse
- https://dev.epicgames.com/documentation/en-us/fortnite/create-your-own-device-using-verse-in-unreal-editor-for-fortnite
- https://dev.epicgames.com/documentation/en-us/fortnite/triad-infiltration-06-blinking-player-visibility-on-damage-in-verse
Verse source files
- 01-standalone.verse · standalone
Turn this into a guided course
Add triad-infiltration-9-creating-visual-aids-in-verse 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.