[Release] BDC's "Shots Fired!" Zombie Aggro Realism Sound Mod (pwnzor0z 1.7.7.1)

BDC

Well-Known Member
Hey guys, got a new one I'm tossing up here but it's an easy one. This one isn't an addon per se but is a modification of an existing script. Basically, sticking with the strictly realistic theme of DayZ, a teammate of mine mentioned how a zombie shouldn't have been able to hear his gunfire at our camp with it raining. So, I modified one file to include the rain (even to the degree) that gives a corrections' factor to modify the distance that zombies within range are notified. In English, it means that those that would be likely to wander over may not if they can't hear it in the first place.

On to the mod!

Step 1) Extract player_fired.sqf from dayz_code.pbo

Player_Fired.SQF is located in dayz_code.pbo within the \compiles folder. Dayz_code.pbo is located within \dayzinstallfolder\@dayz\addons folder. A PBO extraction tool must be used to open the file and get its full contents. Copy the player_fired.sqf file into \dayzinstallfolder\MPMissions\dayz_1.Chernarus\fixes folder. The "fixes" folder can be renamed to any other if any other mods on the server used are using a "custom" or "scripts" folder within this dayz_1.Chernarus folder. The only thing that is important is that it's referenced to the proper place as given in Step 2.

Step 2) Modify compiles.sqf

Compiles.sqf is located in \dayzinstallfolder\MPMissions\dayz_1.Chernarus folder. Modify it and head over to or about line 30 or so. We'll find this line here:

Code:
player_fired = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_fired.sqf";            //Runs when player fires. Alerts nearby Zeds depending on calibre and audial rating

This needs to be commented out and this line added just below it:

Code:
player_fired = compile preprocessFileLineNumbers "fixes\player_fired.sqf";            // Modified to include realism of rainfall sound dampening by ^bdc

What we should have now is this:

Code:
    //player_fired = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_fired.sqf";            //Runs when player fires. Alerts nearby Zeds depending on calibre and audial rating
    player_fired = compile preprocessFileLineNumbers "fixes\player_fired.sqf";            // Modified to include realism of rainfall sound dampening by ^bdc

What we've done in this step is tell the server compiler to point towards a player_fired.sqf within a different folder instead of looking into the dayz_code.pbo file.

Step 3) Modify player_fired.sqf

Open up our now new copy of player_fired.sqf within the \dayzinstallfolder\MPMissions\dayz_1.Chernarus\fixes (or wherrever) folder.

About line 8 or so, find this chunk of code:

Code:
//Alert Nearby
_audible = getNumber (configFile >> "CfgAmmo" >> _ammo >> "audibleFire");
_caliber = getNumber (configFile >> "CfgAmmo" >> _ammo >> "caliber");
_distance = round(_audible * 10 * _caliber);

Just below it, add this chunk:

Code:
// Modified for sound dampening if raining (based upon intensity) by ^bdc
    _newDistance = _distance; // default in case of problem
    _RainAmt = drn_var_DynamicWeather_Rain; // referenced from \z\addons\dayz_code\system\DynamicWeatherEffects.sqf
    if ((_distance > 0) and (_RainAmt > 0)) then {
        if (_RainAmt > 0.72) then { // very heavy rain
            _CorrectionFactor = 0.40; };  // 40%
        if (_RainAmt > 0.53) then { // heavy rain
            _CorrectionFactor = 0.55; };  // 55%
        if (_RainAmt > 0.25) then { // medium rain
            _CorrectionFactor = 0.70; };  // 70%
        if (_RainAmt < 0.25) then { // light rain
            _CorrectionFactor = 0.85; };  // 85%
        _newDistance = (_distance * _CorrectionFactor);
    } else {
        _newDistance = _distance;
    };

Just below it, we'll find this line:

Code:
dayz_disAudial = _Distance;

Comment that line out and then add this below:

Code:
dayz_disAudial = _newDistance;

This is what it should look like now:

Code:
//dayz_disAudial = _distance;
dayz_disAudial = _newDistance;

On or around line 83, we'll find this line:

Code:
[_unit,_Distance/2,true,(getPosATL player)] spawn player_alertZombies;

Change it to read this:

Code:
[_unit,_newDistance/2,true,(getPosATL player)] spawn player_alertZombies;

And that should be it! The distance (radius from the shooter) of a shot fired when it rains should be reduced depending upon the intensity of the rain. Pretty simple.

Any questions or comments? I've got a general help thread (http://www.opendayz.net/threads/bdcs-script-addon-help-thread.13295/) and will also gladly take PM's!

B
 
Back
Top