Meat from players, where am i going wrong?

Audio Rejectz

Well-Known Member
So at present i have this, obviously im trying to have it so players dont need to download it. Probably going totally the wrong way about it, but hey...lol

Code:
// Cut Meat From Dead
_X = false;
_inVehicle = ((vehicle player) != player);
if(!isNull cursorTarget and !_inVehicle and (player distance cursorTarget < 4)) then {
    _hasKnife = "ItemKnife" in items player;
    _isMeat = cursorTarget getVariable["ismeat",false];
    _isHarvested = cursorTarget getVariable["meatHarvested",false];
    _isMan = cursorTarget isKindOf "Man";
    _isAlive = alive cursorTarget;
    _onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
    _canDo = (!r_drag_sqf and !r_player_unconscious and !_onLadder);
    if(!_isAlive and _isMan and _hasKnife and !_isHarvested and _canDo and _isMeat) then {
        _X = true;
        if (s_player_butcher < 0) then {
            s_player_butcher = player addAction ["Skinned", "\z\addons\dayz_code\actions\gather_meat.sqf",cursorTarget, 3, true, true, "", ""];
        };
    };
};
if(!_X) then {
    if(s_player_butcher >= 0) then {
        player removeAction s_player_butcher;
        s_player_butcher = -1;
    };
};

Just for the sake of it i even tried to add to each spawn in the mission

Code:
this AddEventHandler [""killed"",{_this execVM ""fixes\ismeat.sqf""}];";

and the ismeat.sqf

Code:
//sleep 10;
_man setVariable ["deadtime", time];
_man setVariable ["ismeat", true];
//_man setVariable ["flies", 0];

Still no luck :(
 
There is another array some where if i recall correctly its in cfgvehicles it specify the meat count per animal using CAAnimalBase as the root class.
 
What you ask should really only be like one tiny change:

fn_selfActions.sqf:
Code:
         _isMeatable = (cursorTarget isKindOf "Man") or (cursorTarget isKindOf "Animal");
    if (!alive cursorTarget and _isMeatable and _hasKnife and !_isHarvested and _canDo) then {
        if (s_player_butcher < 0) then {
            s_player_butcher = player addAction [localize "str_actions_self_04", "\z\addons\dayz_code\actions\gather_meat.sqf",cursorTarget, 3, true, true, "", ""];
        };
    } else {
        player removeAction s_player_butcher;
        s_player_butcher = -1;
    };

The "meat" is stored here in config.cpp which is in the dayz_code.cpp file
Code:
class CfgSurvival {
    class Inventory {
        class Default {
            //weapons[] = {"Makarov"};
            magazines[] = {"ItemBandage","ItemPainkiller"};
            weapons[] = {"ItemFlashlight"};
            backpackWeapon = "";
            backpack = "DZ_Patrol_Pack_EP1";
        };
    };
    class Meat {
        class Default {
            yield = 2;
        };
        class Cow: Default {
            yield = 8;
        };
        class Cow01: Cow {};
        class Cow02: Cow {};
        class Cow03: Cow {};
        class Cow04: Cow {};
        class Goat: Default {
            yield = 3;
        };
        class Sheep: Default {
            yield = 5;
        };
        class WildBoar: Default {
            yield = 4;
        };
    };
};
 
I assume you mean where are you going wrong in the code, not where you are going wrong in the ethics of eating people? :p

Give dead bodies a yield and make sure you have the right vehicle class. I have no idea what a dead surivor's cfg class is. It might not even be man o_O

If your open to altering the code you could also create a human meat type item in the Dayz Equip. Pity making it peristant is balls hard, as you could have a string in the description pointing to the name of the survivor you've gutted. It could double up as a trophy then!
 
I can confirm that the code i posted does infact work, i tested this on my live server last night with a dead col aziz and a dead USMC sniper which are both man class vehicles. you only get 1 meat off them so it looks like there is a default minimum other than the programed 2 in the default class. heck i might add zombies to the list of meat you can eat.
 
I can confirm that the code i posted does infact work, i tested this on my live server last night with a dead col aziz and a dead USMC sniper which are both man class vehicles. you only get 1 meat off them so it looks like there is a default minimum other than the programed 2 in the default class. heck i might add zombies to the list of meat you can eat.

Really? So i basically over complicated it WAY to much then lol

So for zombies you could just add

Code:
cursorTarget isKindOf "zZombie_base";
 
This is how I did it in 2017


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


//skin player
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;
};


//skin zombie
if (!_isAlive and _hasKnife and !_isHarvested and _isZombie and _canDo) then {
if (s_player_gather_zed_butcher < 0) then {
s_player_gather_zed_butcher = player addAction [localize "str_actions_self_14", "\z\addons\dayz_code\actions\gather_zed_meat.sqf",cursorTarget, 3, true, true, "", ""];
};
} else {
player removeAction s_player_gather_zed_butcher;
s_player_gather_zed_butcher = -1;
};
 
The only thing with doing it in a mission is I think there might not be away to construct new classes around the meat types. If you can find a way then you can have human meat,zombie meat, and animal meat as seperate inventory items.

I also coded in humanity drops and infection chances, but again you might need to crack open PBO's to do that.
 
Just for the sake of me learning something, how come you have !_isZombie and !_isAnimal in your skin player function?


If you don't have those options then you get a 'Gut Human' option come up on Zombies and Animals as well. It looks quite long winded, but it took a crap load of trial and error to getting working just right.
 
Mad props for sharing code shin, im one of those people that has to see it and fiddle with it to understand it. this helps me allot to.
 
This is absolutely awesome! Thanks Xyberviri and Shin!
Now I would like to make it so that players have a chance of getting sick, gutting humans and all and the fact that they could have been lying there dead a while :p
 
well you might want to look at the code for the inspect body command and see if it has anything to do with time if it has any time variables then you can just use that as your chance to get sick.

If you don't have those options then you get a 'Gut Human' option come up on Zombies and Animals as well. It looks quite long winded, but it took a crap load of trial and error to getting working just right.

Wouldn't it make more sense, code and somatic wise to just have it say "Gut Carcass" or even "Gut Corpse" it doesn't have to say animal/human/zed ;)
 
Hey i found this code while digging around in the server_cleanup.fsm:

Code:
{
    if (local _x) then {
        if (_x isKindOf "zZombie_Base") then {
            deleteVehicle _x;
            _delQtyZ = _delQtyZ + 1;
        } else {
            if (_x isKindOf "CAManBase") then {
                _deathTime = _x getVariable ["processedDeath", time];
                if (time - _deathTime > 1200) then {
                    _flies = nearestObject [_x, "Sound_Flies"];
                    if (!isNull _flies) then {
                        deleteVehicle _flies;
                        _delQtyFL = _delQtyFL + 1;
                    };
                    deleteVehicle _x;
                    _delQtyP = _delQtyP + 1;
                };
            };
        };
    };
} forEach allDead;

See that "_deathTime = _x getVariable ["processedDeath", time];" you can just use cursortarget in place of _x and there is how long that corpse is, however this looks to be only for players, just though it would help with the whole infection thing.
 
Wouldn't it make more sense, code and somatic wise to just have it say "Gut Carcass" or even "Gut Corpse" it doesn't have to say animal/human/zed ;)

Depends on how far you want to go. I gather different meat types from the Carcass, so human flesh comes from humans and infected flesh from zombies. I also utilize different functions such as risk of infection and humanity drops.
 
he he aye i gotcha, it would strike me as a feature that would come after you implement the first one in a "ah ha" moment..
 
Back
Top