NPCs emotes

All non-combat animations for NPCs should be handled by the Emote Controller. The Emote Controller is already integrated into many other systems, animation blueprints, character states, and so on. Playing montages directly could create many problems, like NPCs moving and playing emote at the same time.

Emotes can be used in 4 different ways, with the following priority:

The PlayEmote async node

The PlayEmote async node will try to start to emote on the target character once. This behavior is controlled from the BT_Passive behavior tree:

Looping emotes will be played for the duration specified by the Timeout parameter of the PlayEmote async node, or until they are directly stopped (by calling StopEmote), interrupted, or changed to another emote.

After the emote is finished/stopped/interrupted, the NPC will go back to its normal behavior.

The PlayEmote node can affect the behavior of NPCs while emoting:

Please note that the PlayEmote async node is temporarily using IdleEmote Int Stat to store the currently played emote. After the emote is finished, the value of IdleEmote Int Stat will be reverted to the previous value.

Idle emotes

The non-roaming NPCs can play idle emote if they are at their home locations and if they are not engaged in combat. This behavior is controlled from the BT_Passive behavior tree:

The idle emote can be set in two ways, directly setting the value of IdleEmote Int Stat or by Setting Emote State in owning ManualSpawnPoint.

Directly setting the value of IdleEmote Int Stat

The IdleEmote Int Stat can be set for any NPC, independent of the spawning method.

Emote set up in the IdleEmote Int Stat will be prioritized over the Emote State in owning ManualSpawnPoint.

Setting Emote State in owning ManualSpawnPoint

Idle emote can be also set automatically for NPCs spawned from the BP_ManualSpawnPoint.

NPCs using Idle Emote from the owner BP_ManualSpawnPoint will use the same rotation as the owner BP_ManualSpawnPoint. This could be used to rotate emote NPCs in the desired direction, which may be useful for some emotes.

Directly calling Start Emote on Emote Controller

This method is not recommended and was used before we added the PlayEmote async node, which provides the same functionality, but also automatically prepares the NPCs for emoting, integrates emoting with behavior tree and automatically reverts the NPCs exactly to the state before emote. Calling Start Emote directly on Emote Controller does not guarantee that the emote will not be interrupted or blocked by other actions.

Emotes can be also started directly by calling the Start Emote function on Emote Controller of given NPC.

Emotes are already used in that way in theBP_BaseBossControllers (node StartBossEmote), usually in after “blinding” NPCs to prevent them from attacking player

Adding New Emotes

New emotes can be added to the EmotesDataTable (/Game/Characters/Emotes/EmotesDataTable).

Each row in that table represent emote (that can be identified by EmoteID) available for characters using the same Skeleton (column CompatibleSkeleton), e.g. to add new emote for both humanoids (using SK_human_Skeleton) and crocodiles (using SK_crocodile_Skeleton) we need to add two new rows with the same EmoteID, but having different CompatibleSkeleton.

Please note that there can be only one emote using given EmoteID per Skeleton. If there is more than one emote with the same EmoteID and the same CompatibleSkeleton, only the first one in the table will be ever used.

Available EmotedIDs are based on the ECharacterEmotes enum, that can be extended only from Code (EmoteTableRow.h).

Other columns in the EmotesDataTable are: