using { /Fortnite.com/Characters }
using { /Fortnite.com/Animation/PlayAnimation }
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
# This is our main script class. Think of it as the "Brain" of our device.
boss_intro_device := class(creative_device):
# A reference to the NPC Spawner device placed in your level.
# In the UEFN editor, assign your Boss NPC Spawner to this property.
@editable
BossSpawner : npc_spawner_device = npc_spawner_device{}
# A reference to the animation asset to play on the NPC.
# In the UEFN editor, assign your "Rage" animation sequence asset to this property.
@editable
RageAnimation : animation_sequence = animation_sequence{}
# This function runs when the level starts.
OnBegin<override>()<suspends> : void =
# 1. Spawn the NPC and get a reference to it.
# SpawnNPC() returns a ?fort_character, so we unwrap it with 'if'.
if (BossCharacter := BossSpawner.SpawnNPC[]):
# 2. Get the animation controller from the character.
# GetPlayAnimController() is the entry point for animation playback.
AnimController := BossCharacter.GetPlayAnimController()
# 3. Play the animation SYNCHRONOUSLY.
Verse Library
verse
01 Device
Spawns a boss NPC and synchronously plays a rage animation when the level starts.
verse-library/play-an-animation-synchronously-and-get-its-animation-instance/01-device.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.