Limiting enemy voice sounds

Hello, I’ve got this situation with which I could use help :slight_smile:

In our RPG game, every enemy has a set of hit reaction, attack and death voice sounds. What I would like is to limit the number of voice sounds playing to 1 for each enemy actor/entity. The reason for that is if the enemy is making a long “heavy attack” roar and during that the player kills it, the creature is doing two voice sounds at one moment.

My half-working solution: All voice sounds are triggered through animations in UE4. So I’ve decided to put all sounds into one event and in each animation, I trigger the correct sound using a parameter voiceType. I’ve put all voice sounds in multi instruments underneath each other in one track in Fmod event. Each multi instrument has a voiceType parameter condition to play. In Fmod it works perfectly. If I switch the value of voiceType parameter, the ongoing sound stops and new one starts. In game, it doesn’t work at all. Since all voice sounds are triggered from animations, every time the sound is triggered it creates a new instance of Fmod event.

So I thought - if it would be possible to code a limit of one Fmod instance per one actor in UE4, then this solution might work. (I’m trying to do as much as possible inside Fmod without needing a programmer support, since we’re limited by programmer’s time.)

Do you think that this will work and it is possible to limit instances of Fmod event per actor?
Or any ideas on how to do it differently?

Thanks guys :slight_smile:

We’re using UE 4.24 and Fmod 2.00.07

Yes, it is possible to use a single event instance for each character that appears in your game, and to keep that instance alive and re-use it for every sound the character makes.

To do this, you will have to ensure the event instance remains alive at all times (the easiest way to do this in FMOD Studio is to click the “Persistent” toggle button in the event’s macros), and your programmer will have to keep a handle for the event instance in order to send it new commands whenever a new sound is needed, instead of creating a new event instance each time.

As of the time of writing (June of 2020), there is no easy way to limit the event instances associated with a specific game object without using your game’s code unless that game object is guaranteed to be the only one of its type.

Wuood be nice . Meow cap loc puzy

as far as I am aware, this hasn’t been addressed yet in the API.
I do believe it should be more of a priority for the developers since it is something that the competition has been doing already for a very long time.

I’ve added your name to the list of people interested in this feature.