Hi i have an audio_player_device created in my game_manager
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }See Create Your Own Device Using Verse | Unreal Editor for Fortnite Documentation | Epic Developer Community for how to create a verse device.
A Verse-authored creative device that can be placed in a level
game_manager := class(creative_device):
@editable var AudioPlayer : audio_player_device = audio_player_device{} # Runs when the device is started in a running game OnBegin<override>()<suspends>:void= # TODO: Replace this with your code Print("Hello, world!") Print("2 + 2 = {2 + 2}")
I also have a npc_behaviour_basic
using { /Fortnite.com/AI }
using { /Verse.org/Simulation }
using { /Fortnite.com/Characters }
using { /Fortnite.com/Animation/PlayAnimation }
using { /Verse.org/Assets }
using { /UnrealEngine.com/Temporary/SpatialMath }
using { /Fortnite.com/Game }
using { /UnrealEngine.com/Temporary/UI }
using { /Verse.org/Colors/NamedColors }
using { /Fortnite.com/Devices }Getting started: https://www.epicgames.com/fortnite/en-US/creative/docs/uefn/Verse/onboarding-guide-to-programming-with-verse-in-unreal-editor-for-fortnite
A Verse-authored NPC Behavior that can be used within an NPC Character Definition or an NPC Spawner device’s NPC Behavior Script Override.
wolf_npc_behavior_basic := class(npc_behavior):
BehaviorHelp : BehaviorHelper = BehaviorHelper{}var Attack1 : animation_sequence = Assets.FANTASY_WOLF_Bite NPCDamage : float = 10.0 # This function runs when the NPC is spawned in the world and ready to follow a behavior. OnBegin< override>()< suspends>:void= # TODO: Replace this with your code if { NPCAgent := GetAgent[] NPCChar := NPCAgent.GetFortCharacter[] #Allows us to tell npcs to go to different place like the pathfinding service in roblox NPCNav := NPCChar.GetNavigatable[] #Control where npc is looking NPCFocus := NPCChar.GetFocusInterface[] #Control the npc's animations NPCAnim := NPCChar.GetPlayAnimationController[] } then { NPCSpawnLocation := NPCChar.GetTransform().Translation loop { Sleep(0.1) #Checks if npc is alive if (not NPCChar.IsActive[]) { break } if (NewTarget := BehaviorHelp.FindNearestTargetFromPos[NPCChar], NewAgent := NewTarget.GetAgent[]) { spawn{NPCFocus.MaintainFocus(NewAgent)} NavTarget := MakeNavigationTarget(NewAgent) NPCNav.NavigateTo(NavTarget, ?MovementType := movement_types.Walking, ?ReachRadius := 150.0) NPCAnim.Play(Attack1) Sleep(1.0) DistanceDifference := Distance(NPCChar.GetTransform().Translation, NewTarget.GetTransform().Translation) if (DistanceDifference < 200.0) { NewTarget.Damage(NPCDamage) } } } } # This function runs when the NPC is despawned or eliminated from the world. OnEnd< override>():void= # TODO: Replace this with your code Print("Goodbye, NPC!")
and i want to play the audio when NPCAnim.Play(Attack1) occurs
Any help would be grateful