[Release] BDC's Flies On Dead Critters (pwnzor0z 1.7.7.1)

BDC

Well-Known Member
Hey zed heads,

Well I had a real good run last night with a few of us on the server including my wife. I'm surprised, shocked, and anything else you can use to describe how I feel about the fact that my normally introverted wife, whose gaming history was mostly being the girl that stands in the back with the cleric healing spells and never saying a word, plays this game. She doesn't just like it - she LOVES it. I have no idea how or why but she digs it. Well, we'd just gotten done with a scavenging run out on the chopper when she went to go re-supply our cooked meat stash. Out in the field she spots a rabbit and pegs it immediately. She goes tearing off after the corpse but had trouble finding it in the brush. After a couple of minutes, the elusive "Gut Animal" option finally pops up and she can then get the two raw rabbit meat.

Shortly after, I heard her complaining about how it's sometimes difficult to find a critter corpse. I got to thinking about it and I realized that I could help the issue out (if not solve it) by injecting a little bit of consistent realism into the mod, so I came up with the idea of spawning flies at the corpse of a critter. Basically, when you cap a critter (cow, goat, boar, rabbit, whatever), the addon will spawn flies at the location within 5 to 10 seconds. The idea is to match the realism aspect used when a player or an AI bandit dies which leaves flies hanging around.

The modification is quite simple as it really only involves three files and no additional script files to download. This is a work in-progress as it lacks a feature I'd like to see that has to do with the flies being "de-spawned" (both the flies and soundeffect objects being deleted) when the critter corpse disappears (is deleted). If anyone has a sure-fire way of doing this, I'll be happy to add it to the addon and credit you directly for it. I just can't seem to make it happen yet.

On to the addon.

Step 1) Modify compiles.sqf

Note: Most every add-on in DayZ modifies the init.sqf and the compiles.sqf to get to certain player-related functions to allow others to be changed or added. Getting the compiles.sqf pulled out of \z\addons\dayz_code\init folder is the exact same procedure done on any other type of mod. We want to modify an already-extracted compiles.sqf that would be loaded into the \dayzinstallfolder\MPMissions\dayz_1.Chernarus folder.

On or about line 20 of compiles.sqf, you'll find this line:

Code:
player_animalCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_animalCheck.sqf";


Comment that line out (at the beginning with two forward slashes) and add this line directly below it:

Code:
player_animalCheck = compile preprocessFileLineNumbers "fixes\player_animalCheck.sqf";



Here's what it ought to look like now:

Code:
//player_animalCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_animalCheck.sqf";
    player_animalCheck = compile preprocessFileLineNumbers "fixes\player_animalCheck.sqf";

Step 2) Extract and Modify player_animalCheck.sqf

The file player_animalcheck.sqf is located in \z\addons\dayz_code\compile\ where it can be extracted out of dayz_code.pbo located in \dayzinstallfolder\@dayz\addons.

Place the extracted file into \dayzinstallfolder\MPMissions\dayz_1.Chernarus\fixes folder.

Modify the file in an editor. On or about line 26, almost at the bottom, we'll find this line:

Code:
_id = [_pos,_agent] execFSM "\z\addons\dayz_code\system\animal_agent.fsm";

Comment that line out with // slashes then add this line directly below it:

Code:
_id = [_pos,_agent] execFSM "fixes\animal_agent.fsm"; // modified by ^bdc

Here's what we should have now:

Code:
//_id = [_pos,_agent] execFSM "\z\addons\dayz_code\system\animal_agent.fsm";
        _id = [_pos,_agent] execFSM "fixes\animal_agent.fsm"; // modified by ^bdc

The file that's being referenced here, animal_agent.fsm, is a file that runs in a loop and checks the state for each spawned critter on the server. This is the one we're going to add a few lines to in the next installation step.

Step 3) Extract and Modify animal_agent.fsm

File animal_agent.fsm is located in \z\addons\dayz_code\system\ - it must be extracted from dayz_code.pbo located in \dayzinstallfolder\@dayz\addons.

Extract the file out to \dayzinstallfolder\MPMissions\dayz_1.Chernarus\fixes folder.

Edit it and find on or about this line 137, within the "Class Not_Alive" state:

Code:
action=/*%FSM<ACTION""">*/"_timeA = time;"/*%FSM</ACTION""">*/;


Comment that line out with // and then add this directly below it:

Code:
action=/*%FSM<ACTION""">*/"_timeA = time;" \n // Modified by ^bdc to spawn flies when critter dies
          "" \n
          "  _pos = (getPosATL _agent);" \n
          "  _fl = [_pos,0.1,1.5] call bis_fnc_flies;"
          /*%FSM</ACTION""">*/;

Here's what the entire "Class Not_Alive" state ought to look like now:

Code:
class Not_Alive
        {
          priority = 4.000000;
          to="wait";
          precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
          condition=/*%FSM<CONDITION""">*/"!_isAlive"/*%FSM</CONDITION""">*/;
          //action=/*%FSM<ACTION""">*/"_timeA = time;"/*%FSM</ACTION""">*/;
          action=/*%FSM<ACTION""">*/"_timeA = time;" \n // Modified by ^bdc to spawn flies when critter dies
          "" \n
          "  _pos = (getPosATL _agent);" \n
          "  _fl = [_pos,0.1,1.5] call bis_fnc_flies;"
          /*%FSM</ACTION""">*/;
        };

And we're done! That should be it. The process is automatic.

Again, the flies don't despawn until the server_cleanup.fsm file routine decides to delete them and all efforts thus far to delete them manually have failed. So, they will linger long after the corpse is gone (at least 10 minutes and perhaps more).

Anyone have any issues? PM me or visit my help thread here -> http://opendayz.net/threads/bdcs-script-addon-help-thread.13295/
 
Update: This will probably be re-written at some point once a bonafide method for bypassing the bis_fnc_flies function is found (in being able to create and delete both a graphical flies' animation as well as a flies soundSource) and debugged proper.
 
Back
Top