cannibalism

MartinBe

New Member
Hi everybody !
I have a good idea for the administrators who want to create the true apocalyps !
The cannibalism ! It will be so good if we could eat the dead players. And maybe the zombies with a chance to be infected !
thx a lot
 
Dayz epoch goes you the option to gut zombies for zombie parts. You could replace that for meat, but as for the infection chance, not quite sure. Bringing the code over wouldn't be hard, best place to start would be the epoch fn_selfactions.sqf which I use a modified version of on my chernarus server :)
 
2017 has this doesn't it? Maybe someone with more coding knowledge could pull the files from there?
 
Great stuff Shin, i'll have a go at this when i'm free if no-one else has done it before me
 
Do you think it could be made possible to eat the flesh of NPC's too?


Yeah, I would have thought so. You would just need a way of defining the cursorTarget:


_isMan = cursorTarget isKindOf "Man";
_isRealMan = cursorTarget isKindOf "CAManBase";
_isAnimal = cursorTarget isKindOf "Animal";
_isZombie = cursorTarget isKindOf "zZombie_base";


Using these you can narrow out what it is you want to skin - so for dead players:


if (_isMan and !_isAlive and !_isZombie and !_isAnimal and _hasKnife and !_isHarvested and _canDo) then {
if (s_player_gather_human_butcher < 0) then {
s_player_gather_human_butcher = player addAction [localize "str_actions_self_11", "\z\addons\dayz_code\actions\gather_human_meat.sqf",cursorTarget, 3, true, true, "", ""];
};
} else {
player removeAction s_player_gather_human_butcher;
s_player_gather_human_butcher = -1;
};

If IsMan and not Alive and not a Zombie and not an Animal and you have a knife and the body has not already been Harvested, fill your boots...
 
Shin, i assume that "RawInfectedFlesh" and "RawHumanFlesh" is custom to 2017?

If so, how did you add the new items/models? (feel free to just point me to a folder/class where i can learn from it :))

** edit **

O, found it in dayz_equip config.cpp - coolies
 
Put these 3 files in your mission pbo (usually in a fixes folder or something like that)

https://www.dropbox.com/s/hkpirzynmhxkdv4/gather_meat_human.sqf
https://www.dropbox.com/s/3pv577tudbr409r/gather_meat_zombie.sqf
https://www.dropbox.com/s/gej9kik17tvlofe/gather_meat.sqf

In your fn_selfActions.sqf file you need to add the following code after the entire //Repairing Vehicles section.

Code:
// Gut Human - By Knobbin.
    if (!_isAlive and !_isZombie and !_isAnimal and !_isHarvested and _isMan and _hasKnife and _canDo) then {
        if (s_player_butcher_human < 0) then {
            s_player_butcher_human = player addAction [format["<t color='#42426F'>Gut Human%1</t>"], "fixes\gather_meat_human.sqf",cursorTarget, 3, true, true, "", ""];
        };
    } else {
        player removeAction s_player_butcher_human;
        s_player_butcher_human = -1;
    };
   
    // Gut Zombie - By Knobbin.
    if (!_isAlive and !_isAnimal and !_isHarvested and _isZombie and _hasKnife and _canDo) then {
        if (s_player_butcher_zombie < 0) then {
            s_player_butcher_zombie = player addAction [format["<t color='#42426F'>Gut Zombie%1</t>"], "fixes\gather_meat_zombie.sqf",cursorTarget, 3, true, true, "", ""];
        };
    } else {
        player removeAction s_player_butcher_zombie;
        s_player_butcher_zombie = -1;
    };   
   
    if (_isMan and !_isAlive and !_isZombie) then {
        if (s_player_studybody < 0) then {
            s_player_studybody = player addAction [localize "str_action_studybody", "\z\addons\dayz_code\actions\study_body.sqf",cursorTarget, 0, false, true, "",""];
        };
    } else {
        player removeAction s_player_studybody;
        s_player_studybody = -1;
    };
 
} else {
//Gut Human
player removeAction s_player_butcher_human;
s_player_butcher_human = -1;
//Gut Zombie
player removeAction s_player_butcher_zombie;
s_player_butcher_zombie = -1;

If you aren't calling your fn_selfActions.sqf file already you need to do that somewhere, usually in the init file

Code:
fnc_usec_selfActions = compile preprocessFileLineNumbers "fixes\fn_selfActions.sqf";

You also need to call the variables.sqf file from your init.sqf:

Code:
call compile preprocessFileLineNumbers "fixes\variables.sqf";

Inside the variables.sqf file you need to add the following code:

after dbz_Debug = 0; add this:

Code:
s_player_butcher_human = -1;
s_player_butcher_zombie = -1;
 
Put these 3 files in your mission pbo (usually in a fixes folder or something like that)

https://www.dropbox.com/s/hkpirzynmhxkdv4/gather_meat_human.sqf
https://www.dropbox.com/s/3pv577tudbr409r/gather_meat_zombie.sqf
https://www.dropbox.com/s/gej9kik17tvlofe/gather_meat.sqf

In your fn_selfActions.sqf file you need to add the following code after the entire //Repairing Vehicles section.

Code:
// Gut Human - By Knobbin.
    if (!_isAlive and !_isZombie and !_isAnimal and !_isHarvested and _isMan and _hasKnife and _canDo) then {
        if (s_player_butcher_human < 0) then {
            s_player_butcher_human = player addAction [format["<t color='#42426F'>Gut Human%1</t>"], "fixes\gather_meat_human.sqf",cursorTarget, 3, true, true, "", ""];
        };
    } else {
        player removeAction s_player_butcher_human;
        s_player_butcher_human = -1;
    };
 
    // Gut Zombie - By Knobbin.
    if (!_isAlive and !_isAnimal and !_isHarvested and _isZombie and _hasKnife and _canDo) then {
        if (s_player_butcher_zombie < 0) then {
            s_player_butcher_zombie = player addAction [format["<t color='#42426F'>Gut Zombie%1</t>"], "fixes\gather_meat_zombie.sqf",cursorTarget, 3, true, true, "", ""];
        };
    } else {
        player removeAction s_player_butcher_zombie;
        s_player_butcher_zombie = -1;
    };
 
    if (_isMan and !_isAlive and !_isZombie) then {
        if (s_player_studybody < 0) then {
            s_player_studybody = player addAction [localize "str_action_studybody", "\z\addons\dayz_code\actions\study_body.sqf",cursorTarget, 0, false, true, "",""];
        };
    } else {
        player removeAction s_player_studybody;
        s_player_studybody = -1;
    };
 
} else {
//Gut Human
player removeAction s_player_butcher_human;
s_player_butcher_human = -1;
//Gut Zombie
player removeAction s_player_butcher_zombie;
s_player_butcher_zombie = -1;

If you aren't calling your fn_selfActions.sqf file already you need to do that somewhere, usually in the init file

Code:
fnc_usec_selfActions = compile preprocessFileLineNumbers "fixes\fn_selfActions.sqf";

You also need to call the variables.sqf file from your init.sqf:

Code:
call compile preprocessFileLineNumbers "fixes\variables.sqf";

Inside the variables.sqf file you need to add the following code:

after dbz_Debug = 0; add this:

Code:
s_player_butcher_human = -1;
s_player_butcher_zombie = -1;

beautiful thanks for sharing :)
 
I've added it to the bottom of this part, Will this work?
Code:
    //player special variables
    dayZ_lastPlayerUpdate = 0;
    dayZ_everyonesTents =    [];
    dayz_hunger    =            0;
    dayz_thirst =            0;
    dayz_combat =            0;
    dayz_preloadFinished =    false;
    dayz_statusArray =        [1,1];
    dayz_disAudial =        0;
    dayz_disVisual =        0;
    dayz_firedCooldown =    0;
    dayz_DeathActioned =    false;
    dayz_canDisconnect =    true;
    dayz_damageCounter =    time;
    dayz_lastSave =            time;
    dayz_isSwimming    =        true;
    dayz_currentDay =        0;
    dayz_hasLight =        false;
    dayz_surfaceNoise =        0;
    dayz_surfaceType =        "None";
    dayz_noPenalty =        [];
    dayz_heavenCooldown =    0;
    deathHandled =            false;
    dayz_lastHumanity =        0;
    dayz_guiHumanity =        -90000;
    dayz_firstGroup =        group player;
    dayz_originalPlayer =    player;
    dayz_playerName =        "Unknown";
    dayz_sourceBleeding =    objNull;
    dayz_clientPreload =    false;
    dayz_panicCooldown =    0;
    dayz_areaAffect =        2;
    dayz_heartBeat =        false;
    dayzClickTime =            0;
    dayz_spawnDelay =        120;
    dayz_spawnWait =        -120;
    dayz_lootDelay =        3;
    dayz_lootWait =            -300;
    dayz_spawnZombies =        0;
    //used to count global zeds around players
    dayz_CurrentZombies = 0;
    //Used to limit overall zed counts
    dayz_maxCurrentZeds = 0;
    dayz_inVehicle =        false;
    dayz_Magazines =        [];
    dayzGearSave =            false;
    dayz_unsaved =            false;
    dayz_scaleLight =        0;
    dayzDebug = false;
    dayzState = -1;
    s_player_butcher_human = -1;
    s_player_butcher_zombie = -1;
    //uiNamespace setVariable ['DAYZ_GUI_display',displayNull];
    //if (uiNamespace getVariable ['DZ_displayUI', 0] == 2) then {
    //    dayzDebug = true;
    //};
};
 
This has been around since shinkicker added it first to Dayz 2017 :) With the help and graces form him, I also incorporated this into DayZ Mercenary. I had to add in custom food types for it to work correctly after 1.7.6.1.

Other than that it is awesome!


Thanks again shinkicker!
 
I get an error about no entry in bin\cfg\cfgmagazine on first gutting a zombie, looks like the code runs but the zombie body disappears so there is nothing to loot the meat from. Is this code trying to add a meat type thats not in vanilla chernarus or something?

edit: tried it on a player and his inventory was wiped and no meat left on the body, and crashed my game I'm guessing there is another file that needs adding to make this work? Something that does the actual adding of the meat to the body?

zombies also appear to cause a crash when you gut them.
 
If you are running 1.7.6.1 there are food "groups". You have to add the player class (ie Survivor2_DZ etc) as an edible meat. Its kinda creepy once is scripted out :)


EDIT:

dayz_code.pbo>>init>>variables.sqf

ADD the food type of your choice to the cooking section. ie FoodZombieRaw or whatever.

Then in dayz_cod.pbo>>config.cpp you have to define a class for the Zombies and Man. Sort like this.

Code:
        class zZombie_base: Default {
            yield = 1;
            rawfoodtype = "FoodZombieRaw";
        };
       class z_policeman: zZombie_base {};
etc etc.

If you follow how they did it for the other food types (mutton etc) you can figure it out. I did this a while ago so Im a little rusty on it. This should get you in the right direction.
 
Back
Top