# Source URL: https://dev.epicgames.com/documentation/en-us/uefn/verse-starter-template-1-creating-npc-behavior-in-unreal-editor-for-fortnite
# Local doc: epic-docs/documentation/en-us/uefn/verse-starter-template-1-creating-npc-behavior-in-unreal-editor-for-fortnite.md
# Section: Character VFX
# Creates an arrow prop at the NPC's position that visually shows the orientation of the NPC.
CreateArrow(Agent:agent):void=
if :
Character := Agent.GetFortCharacter[]
then:
var Transform:transform = Character.GetTransform()
# Spawn the arrow prop, then set the mesh and material for the prop.
SpawnPropResult := SpawnProp(ForwardArrowAsset, Transform)
if:
SpawnedProp := SpawnPropResult(0)?
then:
set ForwardArrow = SpawnedProp
ForwardArrow.SetMesh(VerseCommander.Meshes.CP_VerseCommander_Floor_01)
ForwardArrow.SetMaterial(VerseCommander.Materials.MI_CP_VerseCommander_CharacterArrow_01)
# Update the arrow prop to the position and orientation of the NPC.
MoveArrow(Agent)
else:
SpawnPropIssue:string = case(SpawnPropResult(1)):
spawn_prop_result.Ok => "Ok"
spawn_prop_result.InvalidSpawnPoint => "Invalid Spawn Point"
spawn_prop_result.SpawnPointOutOfBounds => "Spawn Point Outside Island's Boundaries"
spawn_prop_result.InvalidAsset => "Asset Is Not a Valid creative_prop"
spawn_prop_result.TooManyProps => "Too Many Props Spawned Than Permitted by Island."
_ => "Unknown Error"
ProjectLog("Error spawning prop: {SpawnPropIssue}")
# Update the arrow prop to the position and orientation of the NPC,
Verse Library
verse
04 Character Vfx
Instantiates a visual prop at an agent position and applies meshes and materials.
extracted-snippets/documentation/en-us/uefn/verse-starter-template-1-creating-npc-behavior-in-unreal-editor-for-fortnite/04-character-vfx.verse
Sign in free to read the full source 🌴
This Verse Library file is members-only. Create a free account to view the complete source and download the .verse file.