Need help with play sound notifier in my animation

hi. i did my playsound footsteps in my animation of my game. its a multiplayer. then i tried to test game with 3 player windows. server and client. server is all normal. but when i try with my client it sounds like it plays two or 3 footstep sounds. then i did the same for client 2. same thing. only server is normal. is there something im missing?

you are multicast’ing the sounds reliable?

i didnt use any event for that. well i use the anim notifier playsound.

like this.
 

You need to add another Custom Event, set it to Multicast, then call that event from the Notify Event.

no luck :frowning: still multiple sounds :frowning:

If the sound is played multiple times on your client side, then the function calling the footstep is called too often.

The notify event is only run from the animation blueprint? Sorry I cannot say more without knowing the code.

Basically you just need to run a function with the sound on Multicast, there is no other code needed to replicate a sound. Multicast replicates to all clients.

well in the first place i only use this. play sound. i didnt do any code on animation blueprint

Your approach only is for client setup, remove the sounds and add a ‘New Notify’, call it Steps, see attached image, just use Multicast. Then add Event Notify Steps… see image.

However, if you hear the sound multiple times, then this suggest that the player is replicated too fast, or too often… but I am really just guessing here, it depends on your network code, how the player is replicated.

Use “New notify” in AnimBP. You do not need to multicast or replicate anything because it will trigger every time when animation “hit” notifier on all clients by default.
You probably have different problem. Have you tested with compiled version of the game. Maybe when you test with 3 windows, you focus on one window and hear sound from other clients.
However, try to debug - print some message on notifiy event and see how many times it prints for one client.

i think i only did the 3 windows. well in server when i click on its window, doesnt mix up with therest. only when i did the client. also i place a music cue in the scene with two music and randomize playing either of the two.

so far its the same. server is all good. and client 1 and 2 music are mixing up together

also i did the new notify. its the first thing i did. but same results

Are you using blendspace for walking? Maybe this is just a theory but when you mix 2 animations (walk, run/sprint) and you have notifiers in both animations they will trigger when blended between.
Try to remove notifications from run (for example) and test it.
Also, use print in notifier event to debug. Make one step and see how many times it will output. I think I have similiar problem long time ago (could not remember what I did) and footsteps are almost always echoing (like trigger twice in short time for one step).
If all of these does not help remove all notifiers in animation, add one by one and always test when you add new notifier (so you can potencially notice where’s the problem).

Also maybe you can try this:

29846-2015-02-13_09-12-23.png

Set it to Highest Weighted Animation

well no luck :3 i tried doing it on thirdperson template. add the play sound notifier on running. still plays double on client 1 and client 2 :3 maybe its a bug? i guess XD

Well it could be bug but maybe there’s workaround.
Create a new bool variable in your AnimBP and call it for example “IsFootStepPlaying”.
On your notify event connect “IsFootStepPlaying” to false with Playsound function and set bool to true. Use delay or timer, for example, 0.2 sec or so and set bool to **false **again, so it will play only one sound every 0.x seconds.

For anyone who reads this later, the issue is usually that the OP has his “footstep” event triggering in a blendspace. When the blendspace blends animations (he changes direction and a new animation starts playing) the footstep notify is called again immediately and plays twice or more. Have to be careful using notifys for sound in blendspace. Make sure the notify is only being called in one direction at once, not twice in the blended version of two animations.

1 Like