Hi! I have a system where I am making a sphere trace that can target multiple enemies, and it plays a specific sound depending on if an enemy has been hit or if nothing has been detected. However, for example, if the trace detects 3 enemies, it will play the sound 3 times. I tried using a doOnce node, but this still played the audio for however many objects are included in the sphere trace.
I’m also detecting whether the hit targets implement a specific interface, so that when the sphere trace happens and no enemies are detected, it plays a “fail” sound. However, as its also picking up on static meshes in the scene, it plays that fail sound for however many static meshes are included in that sphere trace.
Is there a way I can make it just play once? So for example, if the sphere trace happens and there are 3 enemies, it will recognize that the hit is successful and play the audio once instead of stacking 3 on top of each other.
Here’s what the blueprint looks like. I’m doing this on the main character blueprint. There’s probably a more efficient way for me to do this, I’m still learning so any ways of improving it would be appreciated
TLDR; I’d like to have one sound play depending on if something is hit or not, instead of the audio stacking depending how many targets are included in the hit.