Cannibalism

seaweeduk

OpenDayZ Rockstar!
Cannibalism


What it does....
Allows you to gut and eat dead players. There is a 10% chance of cutting your finger and losing 1000 blood and a deduction of -500 humanity for each gutting.

Requirements
A brain and the ability to read and edit text
Easy - 5 mins

Thanks dayz 2017 guys for writing and sharing this code, I just hacked something together from their code with some additional stuff so that it would work in my mission file on vanilla dayz.

Code:
private["_hasKnife","_qty","_item","_text","_string","_type","_loop","_meat","_timer"];
_item = _this select 3;
_hasKnife =    "ItemKnife" in items player;
_type = typeOf _item;
_hasHarvested = _item getVariable["meatHarvested",false];

player removeAction s_player_butcher;
s_player_butcher = -1;

if (_hasKnife and !_hasHarvested) then {

    _loop = true;
    _rnd = random(100);

    player playActionNow "Medic";
    [player,"gut",0,false] call dayz_zombieSpeak;
    _item setVariable["meatHarvested",true,true];

    if (_rnd > 90) then {
        r_player_inpain = true;
        player setVariable["USEC_inPain",true,true];
        r_player_blood = r_player_blood - 1000;
        cutText ["You feel the knife slice your finger.", "PLAIN DOWN"];
    };

    _qty = (random 3);

    _id = [player,50,true,(getPosATL player)] spawn player_alertZombies;

    dayzHumanity = [player,-500];
    _id = dayzHumanity spawn player_humanityChange;

    _array = [_item,_qty];
    _meat = "FoodSteakRaw";

        for "_x" from 1 to _qty do {
                _item addMagazine "FoodSteakRaw";
                _result = [player,_meat] call BIS_fnc_invAdd;
                if (_result) then {

                } else {
                    cutText ["You didn't have enough room to store the meat :(", "PLAIN DOWN"];
                    _x = _qty;
                }

        };

    sleep 8;
    cutText ["You have gutted a human your hands are covered with blood, you feel your humanity lower.", "PLAIN DOWN"];
};

Save this code as gather_meat_Human.sqf inside your fixes folder in your mission file

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

Code:
    //####    Gut fools ####
    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["Gut Human"], "fixes\gather_meat_human.sqf",cursorTarget, 0, false, true, "", ""];
        };
    } else {
        player removeAction s_player_butcher_human;
        s_player_butcher_human = -1;
    };

    //##############################

Lower down the file find

Code:
player removeAction s_player_flipveh;

and below it add
Code:
//Gut Human
player removeAction s_player_butcher_human;
s_player_butcher_human = -1;

If you aren't calling your dayz_code's fn_selfActions.sqf file from within your mission already you need to do that. You also need to add variables.sqf if it's not already in your mission.

To add both files copy them from dayz_code.pbo and update your init.sqf to point to the new locations within the mission file.

Next inside the variables.sqf file at the end you need to add the following code:

after dayzState = -1;

Code:
s_player_butcher_human = -1;

This should be all you need to eat people :D If you use serverside anti hack you'll need to whitelist the action "s_player_butcher_human"

If you use Churchie's "strip clothes" mod you will have problems with people gutting bodies twice, to fix this use my version of the clothes script instead which has a small check added to fix the problem - http://pastebin.com/rrugX9XW

Terms & Conditions - When you download or copy this code you agree to not charge any money for installing this script. You may not use the code for profit in any way and all modifications with the original code must be shared publicly.
 
Last edited:
Back
Top