Audio Stacking on Hit

Hey, so I got my shotgun BP finished the other day, the only issue is that when I shoot an enemy it causes 10 hit sounds to play (1 for every line trace that hits the actor) and I am not quite sure how to resolve this.

This is where the audio triggers in the enemyBP:

These is the shotgun line traces:

I haven’t been able to figure out how to get this audio stacking to stop so any help would be very much appreciated! If anymore information is needed just let me know, I haven’t really played around with sounds before this.

It sounds like you actually do have a pretty good sense of what’s causing this! You’re triggering the Play Sound at Location somewhere you know will get hit for every line trace, and you know that’s not the behavior you want.

(Is the decreasing enemy health currently working the way you intended? If not, changing where the Event Hit Enemy is triggered will probably fix both those problems.)

But regardless - what you could do is put the audio play command at the end of that For Loop, which would guarantee the hit sound can only play once per gun shot. Could use a boolean or something to keep track of if any of the Line Traces hit the actor, then use that to determine if you want to fire a sound or not.

Thank you so much! I actually just figured this issue out last night and my solution was pretty much exactly how you desribed it, the only thing i did slightly different was put a sequence in at the end and before i played the sound on pin 1 (pin 0 deletes the actor) i added a do once node with no reset, now it just plays the sound once (i did the same thing for the shotgun fire function and to my surprise it worked pretty much perfectly) :slight_smile:

The only issue with that currently is rarely if youre spamming the fire button on the shotgun it might not play the fire sound and rarely the enemy might not play the hit sound.

EDIT:

Im not sure why that bug is happening, it might be because of the do once node, ill try removing that and see if i can get that bug to happen again

Again, thank you for your reply, i really appreciate it! :slight_smile: