DISTANCE WEAPON SOUNDS

In PR, we attach the distant sound to the muzzle flash effect and set it so it can be heard for an extremely long distance. Hopefully this will explain it for you mate.....

There's only four separate distant sounds we use in PR (9mm, 5.56, 7.62 and 50cal). Reason being that when you hear a distant gunshot in real life, you can only audibly distinguish the calibre (not so much the specific weapon).

==

Step 1: Check the weapons muzzle flash ==

You can define what muzzle flash effect a weapon is using in it's tweak file.

> ObjectTemplate.addTemplate S\_usrif\_m16a4\_Zoom
>
>
>
> ObjectTemplate.setPosition 0/0.0466002/-0.106539
>
> ObjectTemplate.addTemplate e\_muzz\_m4
>
> ObjectTemplate.setPosition -0.00513785/0.0539762/0.595038
>
> ObjectTemplate.addTemplate e\_shellejection\_556
>
> ObjectTemplate.setPosition 0/0.053/0
>
>
>
>
> ObjectTemplate.setRotation -10/0/0
>
>

Note that this M16 is using the "e\_muzz\_m4" effect for it's muzzle flash.

Step 2: Attach your distant sound to the weapons muzzle flash effect

Navigate to the muzzle flash effects folder : "objects\_server-zip\Effects\weapons\muzzleflashes\emitters"

and open up the appropriate muzzle flash effect, in this case "e\_muzz\_m4". In the code below, there's a sound template already in place on all the muzzle flash effects in BF2 (they just don't have any sound attached to them). So here's how the sound template for it looks in PR.....

> ObjectTemplate.activeSafe Sound S\_e\_muzz\_m4\_Start
>
>
>
> ObjectTemplate.modifiedByUser "Brian Hernandez"
>
> [u]ObjectTemplate.lowSamples 2147483647
>
> ObjectTemplate.mediumSamples 2147483647
>
> ObjectTemplate.soundFilename "objects/weapons/handheld/usrif\_m203/sounds/556\_distant.wav"
>
> ObjectTemplate.loopCount 1
>
> ObjectTemplate.is3dSound 1
>
> ObjectTemplate.stopType 1
>
> ObjectTemplate.volume 0.6
>
> ObjectTemplate.pitch 1
>
> ObjectTemplate.reverbLevel 1
>
> ObjectTemplate.minDistance 1
>
>
>
>
> ObjectTemplate.halfVolumeDistance 300[/u]
>
>

==

Step 3: Balancing distances ==

You want to have it set up so that at close/medium ranges, you hear the 3p firing sound of the weapon. While at long ranges, you hear the distant sound. In PR, it's set up like so....

>
>
>
>
>
>
>
>
>
> M16 3p firing sound (coming from the rifle)
>
>

(the actual wav is very loud)

>
>
>
>
>
>
> ObjectTemplate.minDistance 3 (played at max volume for thirty meters)\*
>
>
>
>
> ObjectTemplate.halfVolumeDistance 10 (played at half volume for one hundred meters)\*
>
>

5.56mm distant sound (coming from the rifle's muzzle flash effect)

(the actual wav is very quiet)

>
>
>
>
>
>
> ObjectTemplate.minDistance 1 (only at max volume for ten meters)\*
>
>
>
>
> ObjectTemplate.halfVolumeDistance 300 (played at half volume for one hundred meters)\*
>
>

\*bare in mind that the distance absorption effect takes care making things seem a little more realistic in terms of how the sounds fade out.

So, out to 100m you hear the actual 3p firing sound of the M16 itself. You don't hear the distant sound because it's too quiet in comparison and is drowned out at close ranges. However, when it gets up to 100m+ away from you, the 3p firing sound will die off and all that's left is the distant sound.

==

Step 4: Correcting phase

# ```

```

I won't bore you with why this happens, but unless the sounds are coming from the exact same position, they will have conflicts with each other. So to correct this in PR, we set all the 3p firing sounds to come from the exact same position as the muzzle flash effect (which is where the distant sound is coming from).

If you look at the code in step one, you'll see the position for the muzzle flash effect "ObjectTemplate.setPosition -0.00513785/0.0539762/0.595038". Just take value and set the "ObjectTemplate.position" on the 3p firing sound to be the exact same.