So i have a few questions for you guys about sounds:
My game now has an enemy and the player itself, they can both shoot.
Now i want to add a sound when the player and the enemy shoot, but how do I make the shooting sound from the enemy ambient, because i want the sound to appear louder when closer to the enemy.
I’ve already tried adding a sound to the projectile, but if the projectile hits me, it gets louder and the sound vanishes instantly.
Secondly i want to add a sound when the enemy hits the ground with every step. I’ve tried adding nodes to the animation, but this makes the sound the same volume everywhere on the map.
Any help?
Make sure you’re playing the sound “at location” in the correct location or “attached” to your characters. You need to add Sound Attenuation to your sound. You can create one in the content browser from add new > sounds > sound attenuation. And in there you can change lots of various settings on how your sound should behave based on distance and that kind of stuff. Then you can open your sound file and scroll to the bottom of the list and add your attenuation to the sound there. (You can also add it when you play the sound if you want to use that same sound with a different or no attenuation elsewhere.)
As for making sounds for footsteps, you would probably want to do it with animation notifies in the animation editor. If you have set your sound attenuation up in your sound file already, these sound will automatically use the same attenuation settings, so there’s no need for anything extra here.
I did the thing you just said for the animation, but for some reason, it’s the same volume when i’m next to the enemy, as well as when i’m on the other side of the map. I don’t know why this is, and before you ask, i do not use the same animation for the enemy as for the player
Okay so now the falloff of the sound does work, but for some reason the sound is bound to the player spawn, and not the enemy location, but i do have the enemy location clearly used, as seen here
I think you’re destroying the actor before you play the sound, which means the mesh location doesn’t exist anymore and then just places the sound somewhere else. (Possibly 0,0,0)
Well the problems in detail:
When adding a death sound IN THE ENEMY’S BLUEPRINT creates the sound source at the player spawn, which means i do hear it when i kill the enemy from the player start, but not when i’m next to the enemy when killling him. I don’t get it, as the location shown in my previous post clearly states that it’s located to is the enemy.
On the other hand, when using the animation, it also doesn’t add the sound source to the enemy’s mesh, but also the player spawn. I don’t know why, and it’s frustrating as hell!