Sound keeps playing even after AI dead

I have created a event start fire after 0.4 seconds created another event stop fire and the audio also plays for 0.4 seconds.But before this 0.4 seconds if the pawn dies while firing it keeps on playing the sound

I tried different ways to solve this but all end in the same issue.

Yes now the sound stop when destroyed but now its spawning sound at different time.
I don’t know whether I have connected nodes properly

When you spawn the sound in the AI, attach it to a component in the AI like this:

That way, when the AI dies, the component gets trashed and the sound stops playing.

Your BP is very convoluted. All you need is something like:

Sorry I really don’t know what to do here because I can’t add component to this BP I cant even add an audio component or a mesh component here so I am am very much confused what is to be added to “attach to component”.

I can see it’s a blueprint and you can always put components in a blueprint. It doesn’t matter what it is, a scene is good because it doesn’t show anything:

But I see you spawned and attached a sound in your picture above:

300501-spawn.jpg

Just like that, but you don’t need all these extra nodes like start fire and stop fire, because the main node is being called, that’s all you need.

I’m glad it works! I see the problem now, you were missing your components window, but I see you found it :slight_smile:

In this image it’s not

show anything like add component.
Its showing only “Add new”. I created this only for black board to tell AI when to start shoot and when to stop

Hi ClockworkOcean,
Thanks a lot for helping. Sorry I am an amateur that’s why I was confused a lot in this.
Now everything is working perfectly well.

300512-perfect2.png