How To Stop Anim Notify 'FMODPlaySound' in Animations for AI?

There’s an AI in my VR game that has random behavior. To play its anim sounds I’m using FMODPlayEvent notifies on its anim graphs in the anim blueprint.

Sometimes when the AI changes its state and goes from one animation to another, the sounds from the new animation will play on top of the previous one. For instance, if the AI is at the beginning of its chopping wood anim and then switches to a DrinkTea animation in the middle of it, I’ll still hear the wood chopping sound continue as he drinks because the Wood FMODPlayEvent was triggered at the beginning of its timeline and plays for the duration of the animation.

Is there a best practice to program stopping sounds when the AI transitions between various states using blueprints?

In the UE4 Content Browser, if change the view options to show plugin content, under FMODStudio Content you will find the AnimNotify blueprint. You are able to modify this to suit your needs, or just use it as a guide to create your own notify.

You will need a way of knowing when an animation has changed or when a sound should stop. The AnimNotify sounds are usually used for very short sounds (eg. footsteps).

1 Like

Thanks, Cameron! I’ll look into the AnimNotify bp and reassess my event implementation, perhaps by breaking up the sounds into smaller pieces that each have an anim notify.