Available animations for NPCs ?
I finally got an NPC (avatar) running around my world. Now I am wondering where do I find list of all available animations for NPC avatars. For example, if I need for NPC to grab a weapon, how do I know what animations for holding sword, axe, pistol, shotgun, etc. are called and what they look like?
const npc = this.entity.as(npcs.Npc); npc.tryGetPlayer().then((player) => { player?.playAvatarGripPoseAnimationByName(AvatarGripPoseAnimationNames.Fire); });From the NPC's entity, cast it to an NPC type. You can then use "tryGetPlayer()" to get the player (or not!). Note this is a promise so you'll have to call ".then" to do some action when the function has done its asynchronous work.
This player will have the "playAvatarGripPoseAnimationByName" function with which you can trigger these animations. Instead of remembering the string names, use the AvatarGripPoseAnimationNames enum and use its discrete set of values.
Also my advice would be to cache this player at the start so you don't have to use this promise each time you want to trigger the anim