How to make a killer with proximity audio?

I want to make a killer that chases you and kills you on contact but also plays audio that gets louder the closer you are like footsteps. If anyone knows how to do this please tell.




























🙂
I suppose that with a Proximity plugin you can do that easily, there are several, I haven't tried them so I can't give you personal suggestions, but you can try this:

What you can do is:
1. calculate difference in X between player and target event (in the below example, event number 5)
2. calculate difference in Y between player and target event
3. Pythagoras to get a distance value in a straight line, multiply by some factor (in the below example, 10)
4. calculate the volume of the sound; basically just "100 minus calculated distance value", with a conditional to return 0 if the calculation is below 0.
5. play the sound

Some parts of this you can do with event commands, but I prefer to just put the whole thing in a script. This will need to be a parallel event so you may want to put in a wait of 5 frames or more.

JavaScript:
◆Wait:5 frames
◆Script:const Dist5X = Math.abs($gamePlayer.x - $gameMap.event(5).x);
:      :const Dist5Y = Math.abs($gamePlayer.y - $gameMap.event(5).y);
:      :const Dist = Math.round(10*Math.sqrt(Dist5X ** 2 + Dist5Y ** 2));
:      :const BgsVol = (100-Dist <= 0 ? 0 : 100-Dist)
:      :AudioManager.playBgs({name:'HeavyBreathing', volume: BgsVol, pitch:100});
What you can do is:
1. calculate difference in X between player and target event (in the below example, event number 5)
2. calculate difference in Y between player and target event
3. Pythagoras to get a distance value in a straight line, multiply by some factor (in the below example, 10)
4. calculate the volume of the sound; basically just "100 minus calculated distance value", with a conditional to return 0 if the calculation is below 0.
5. play the sound

Some parts of this you can do with event commands, but I prefer to just put the whole thing in a script. This will need to be a parallel event so you may want to put in a wait of 5 frames or more.

JavaScript:
◆Wait:5 frames
◆Script:const Dist5X = Math.abs($gamePlayer.x - $gameMap.event(5).x);
:      :const Dist5Y = Math.abs($gamePlayer.y - $gameMap.event(5).y);
:      :const Dist = Math.round(10*Math.sqrt(Dist5X ** 2 + Dist5Y ** 2));
:      :const BgsVol = (100-Dist <= 0 ? 0 : 100-Dist)
:      :AudioManager.playBgs({name:'HeavyBreathing', volume: BgsVol, pitch:100});
But if this is a parallel event how do I make it so it still game overs on event touch.
But if this is a parallel event how do I make it so it still game overs on event touch.
Ah, of course. What you want to do is to make this parallel event separate from the chasing monster.

The monster will just be something that has a move route and will trigger on event touch, with the result being GAMEOVER (or start battle, or whatever).

The parallel event you would just place anywhere on the map; it doesn't matter where.
Ah, of course. What you want to do is to make this parallel event separate from the chasing monster.

The monster will just be something that has a move route and will trigger on event touch, with the result being GAMEOVER (or start battle, or whatever).

The parallel event you would just place anywhere on the map; it doesn't matter where.
Ty so much for the help 🙂

Original thread: https://forums.rpgmakerweb.com/threads/how-to-make-a-killer-with-proximity-audio.161086/