[Release] Remove Flies on Dead Bodies

QueZ

Well-Known Member
Credit goes to anyone who knows how to script I guess... I figured it out on my own not sure if I get credit but here goes. When DayZ 1.8 came out they have fixed this issue, however it's still a problem on older versions of dayz on different maps as well as other mods that still have the fly sounds play on dead bodies which causes lag on heavy PVP servers and is plain annoying on PVP servers as well.

WHAT THIS DOES: A script to remove the Fly Sounds on Dead Bodies (for older versions of dayz and other mods with this issue). It will reduce lag on your server if you have lots of dead bodies on it (PVP servers) and remove the plain annoying and loud fly sounds.

  • HELP THREAD:HERE
  • Installation Time: About 5 to 10 minutes.
  • Difficulty: Moderate
  • Requirements: Notepad++, PBO Manager, dayz_mission.pbo, player_death.sqf, compiles.sqf


--------------------------------------------------------------------------------------------------------

Step 1 - Make a folder called fixes

Step 2 - Copy your compiles.sqf file into the fixes folder.
(Lots of tutorials on how to get your compiles.sqf on opendayz)

Step 3 - In compiles.sqf look for the following line
Code:
player_death =                compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_death.sqf";

And change it to this
Code:
player_death =                compile preprocessFileLineNumbers "fixes\player_death.sqf";

Step 4 - Open your init.sqf and find this line
Code:
call compile preprocessFileLineNumbers "\z\addons\dayz_code\init\compiles.sqf";                //Compile regular functions

And change it to this
Code:
call compile preprocessFileLineNumbers "fixes\compiles.sqf";                //Compile regular functions

Step 5 - Copy the player_death.sqf file from your dayz_code.pbo into your fixes folder. To get this find your dayz map installation in the Arma 2 directory @DayZMapName, find dayz_code.pbo and inside you'll find player_death.sqf

Step 6 - Open player_death.sqf and find this line
Code:
["dayzFlies",player] call broadcastRpcCallAll;

and comment it out like this
Code:
//["dayzFlies",player] call broadcastRpcCallAll;

Step 7 - Place the fixes folder into the ROOT of your mission.pbo (inside the fixes folder should be compiles.sqf and player_death.sqf that you modified. Remember the init.sqf must also be in the root of your mission.pbo (not inside the fixes folder).

Step 8 - Repack mission.pbo, upload to server and enjoy a flyless world!



IF YOU CANNOT FIND THE player_death.sqf make a new .sqf file and name it player_death.sqf and paste this code inside of it. It should work on any server (appart from 1.8 cherno servers). Then put this sqf file into the fixes folder
Code:
private["_array","_source","_kills","_killsV","_humanity","_wait","_myKills"];
if (deathHandled) exitWith {};
 
deathHandled = true;
//Death
 
_body =        player;
_playerID =    getPlayerUID player;
 
//Send Death Notice
["dayzDeath",[dayz_characterID,0,_body,_playerID,dayz_playerName]] call callRpcProcedure;
 
_id = [player,50,true,getPosATL player] spawn player_alertZombies;
 
sleep 0.5;
 
player setDamage 1;
0.1 fadeSound 0;
 
player setVariable ["NORRN_unconscious", false, true];
player setVariable ["unconsciousTime", 0, true];
player setVariable ["USEC_isCardiac",false,true];
player setVariable ["medForceUpdate",true,true];
//remove combat timer on death
player setVariable ["startcombattimer", 0, true];
r_player_unconscious = false;
r_player_cardiac = false;
 
//_id = player spawn spawn_flies;
 
_humanity =        0;
_wait =        0;
 
_array = _this;
if (count _array > 0) then {
    _source = _array select 0;
    _method = _array select 1;
    if (!isNull _source) then {
        if (_source != player) then {
            _canHitFree =    player getVariable ["freeTarget",false];
            _isBandit = (["Bandit",typeOf player,false] call fnc_inString);
            _myKills =        ((player getVariable ["humanKills",0]) / 30) * 1000;
            if (!_canHitFree and !_isBandit) then {
                //Process Morality Hit
                _humanity = -(2000 - _myKills);
                _kills =        _source getVariable ["humanKills",0];
                _source setVariable ["humanKills",(_kills + 1),true];
                _wait = 300;
            } else {
                //Process Morality Hit
                //_humanity = _myKills * 100;
                _killsV =        _source getVariable ["banditKills",0];
                _source setVariable ["banditKills",(_killsV + 1),true];
                _wait = 0;
            };
            if (_humanity < 0) then {
                _wait = 0;
            };
            if (!_canHitFree and !_isBandit) then {
                ["dayzHumanity",[_source,_humanity,_wait]] call broadcastRpcCallAll;
            };
        };
    };
    _body setVariable ["deathType",_method,true];
};
 
terminate dayz_musicH;
terminate dayz_lootCheck;
terminate dayz_slowCheck;
terminate dayz_animalCheck;
terminate dayz_monitor1;
terminate dayz_medicalH;
terminate dayz_gui;
terminate dayz_zedCheck;
terminate dayz_locationCheck;
terminate dayz_combatCheck;
 
//Reset (just in case)
//deleteVehicle dayz_playerTrigger;
disableUserInput false;
r_player_dead = true;
 
"dynamicBlur" ppEffectEnable true;"dynamicBlur" ppEffectAdjust [4]; "dynamicBlur" ppEffectCommit 0.2;
 
"colorCorrections" ppEffectEnable true;
"colorCorrections" ppEffectAdjust [1, 1, 0, [1, 1, 1, 0.0], [1, 1, 1, 0.01],  [1, 1, 1, 0.0]];
"colorCorrections" ppEffectCommit 1;
 
//Player is Dead!
3 fadeSound 0;
0 cutText ["", "BLACK",10];
dayz_DeathActioned = true;
sleep 1;
 
TitleText[localize "str_player_12","PLAIN DOWN",5];
 
dayz_originalPlayer enableSimulation true;
 
addSwitchableUnit dayz_originalPlayer;
setPlayable dayz_originalPlayer;
selectPlayer dayz_originalPlayer;
 
_myGroup = group _body;
[_body] joinSilent dayz_firstGroup;
deleteGroup _myGroup;
 
3 cutRsc ["default", "PLAIN",3];
4 cutRsc ["default", "PLAIN",3];
 
if (count _array > 0) then {
    _body setVariable ["deathType",_method,true];
};
 
_body setVariable["combattimeout", 0, true];
 
//["dayzFlies",player] call broadcastRpcCallAll;
sleep 2;
 
1 cutRsc ["DeathScreen","BLACK OUT",3];
 
 
playMusic "dayz_track_death_1";
 
"dynamicBlur" ppEffectAdjust [0]; "dynamicBlur" ppEffectCommit 5;
"colorCorrections" ppEffectAdjust [1, 1, 0, [1, 1, 1, 0.0], [1, 1, 1, 1],  [1, 1, 1, 1]];"colorCorrections" ppEffectCommit 5;
 
Back
Top