# This is our main script. It lives inside a Verse Device.
using { FortNiteCommunity }
# This is the function that runs when the NPC is born.
OnBegin<override>()<suspends>: void =
# First, we get the Agent.
# The Agent is the NPC's "brain" or controller.
Agent := GetAgent[]
# Now, we get the actual character body.
# We use GetFortCharacter to find the body.
# If it finds the body, we save it in 'FortChar'.
if (FortChar := Agent.GetFortCharacter[]):
# Great! We found the character.
# Now we change its color.
# We set the Primary Color to Blue.
FortChar.SetPrimary_color(Color.BLUE)
else:
# Uh oh. We could not find the body.
# Let's print a message to help us fix it.
Logger.Print("Could not find the NPC body!", ?Level:= log_level.Warning)
Verse Library
verse
01 Fragment
Retrieves an NPC character on spawn and modifies its primary color properties.
verse-library/this-function-runs-when-a-character-is-spawned-from-the-npc-spawner/01-fragment.verse