Update various actions and add switch to standing pose

Made by @Victor-the-Cleaner
This commit is contained in:
A Man
2022-04-19 19:33:51 +02:00
parent b46711bc18
commit 6ccf68c6aa
4 changed files with 141 additions and 94 deletions

View File

@@ -1,41 +1,41 @@
if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;};
dayz_actionInProgress = true;
private ["_bottletext","_hastinitem","_qty","_dis","_sfx","_bottle","_finished","_waterbottles","_platicBottles","_magsPlayer","_bottles"];
_bottletext = getText (configFile >> "CfgMagazines" >> "ItemWaterBottle" >> "displayName");
_waterbottles = ["ItemWaterBottleInfected","ItemWaterBottle","ItemWaterBottleSafe","ItemWaterbottle1oz","ItemWaterbottle2oz","ItemWaterbottle3oz","ItemWaterbottle4oz","ItemWaterbottle5oz","ItemWaterbottle6oz","ItemWaterbottle7oz","ItemWaterbottle8oz","ItemWaterbottle9oz","ItemPlasticWaterBottle","ItemPlasticWaterBottleInfected","ItemPlasticWaterBottleSafe","ItemPlasticWaterbottle1oz","ItemPlasticWaterbottle2oz","ItemPlasticWaterbottle3oz","ItemPlasticWaterbottle4oz","ItemPlasticWaterbottle5oz","ItemPlasticWaterbottle6oz","ItemPlasticWaterbottle7oz","ItemPlasticWaterbottle8oz","ItemPlasticWaterbottle9oz"];
_platicBottles = ["ItemPlasticWaterBottle","ItemPlasticWaterBottleInfected","ItemPlasticWaterBottleSafe","ItemPlasticWaterbottle1oz","ItemPlasticWaterbottle2oz","ItemPlasticWaterbottle3oz","ItemPlasticWaterbottle4oz","ItemPlasticWaterbottle5oz","ItemPlasticWaterbottle6oz","ItemPlasticWaterbottle7oz","ItemPlasticWaterbottle8oz","ItemPlasticWaterbottle9oz"];
_magsPlayer = magazines player;
_qty = {_x in _waterbottles} count _magsPlayer;
_hastinitem = true;
a_player_boil = true;
player removeAction s_player_boil;
//s_player_boil = -1;
player removeAction s_player_cook;
player removeAction s_player_thaw;
a_player_boil = true;
//s_player_boil = -1;
if ({_x in _platicBottles} count _magsPlayer > 0) then {
_hastinitem = {_x in _magsPlayer} count boil_tin_cans > 0;
local _bottleText = getText (configFile >> "CfgMagazines" >> "ItemWaterBottle" >> "displayName");
local _waterbottles = ["ItemWaterBottleInfected","ItemWaterBottle","ItemWaterBottleSafe","ItemWaterbottle1oz","ItemWaterbottle2oz","ItemWaterbottle3oz","ItemWaterbottle4oz","ItemWaterbottle5oz","ItemWaterbottle6oz","ItemWaterbottle7oz","ItemWaterbottle8oz","ItemWaterbottle9oz","ItemPlasticWaterBottle","ItemPlasticWaterBottleInfected","ItemPlasticWaterBottleSafe","ItemPlasticWaterbottle1oz","ItemPlasticWaterbottle2oz","ItemPlasticWaterbottle3oz","ItemPlasticWaterbottle4oz","ItemPlasticWaterbottle5oz","ItemPlasticWaterbottle6oz","ItemPlasticWaterbottle7oz","ItemPlasticWaterbottle8oz","ItemPlasticWaterbottle9oz"];
local _plasticBottles = ["ItemPlasticWaterBottle","ItemPlasticWaterBottleInfected","ItemPlasticWaterBottleSafe","ItemPlasticWaterbottle1oz","ItemPlasticWaterbottle2oz","ItemPlasticWaterbottle3oz","ItemPlasticWaterbottle4oz","ItemPlasticWaterbottle5oz","ItemPlasticWaterbottle6oz","ItemPlasticWaterbottle7oz","ItemPlasticWaterbottle8oz","ItemPlasticWaterbottle9oz"];
local _magsPlayer = magazines player;
local _qty = {_x in _waterbottles} count _magsPlayer;
local _hasTinItem = true;
local _wasStanding = ["perc", animationState player] call fnc_inString;
local _finished = false;
if ({_x in _plasticBottles} count _magsPlayer > 0) then {
_hasTinItem = {_x in _magsPlayer} count boil_tin_cans > 0;
};
if !(_hastinitem) exitWith {
private ["_tin1text","_tin2text","_tintext"];
_tin1text = getText (configFile >> "CfgMagazines" >> "TrashTinCan" >> "displayName");
_tin2text = getText (configFile >> "CfgMagazines" >> "ItemSodaEmpty" >> "displayName");
_tintext = format["%1 / %2",_tin1text,_tin2text];
format[localize "str_player_31",_tintext,localize "str_player_31_fill"] call dayz_rollingMessages;
a_player_boil = false;
dayz_actionInProgress = false;
if (!_hasTinItem) exitWith {
local _tin1text = getText (configFile >> "CfgMagazines" >> "TrashTinCan" >> "displayName");
local _tin2text = getText (configFile >> "CfgMagazines" >> "ItemSodaEmpty" >> "displayName");
local _tintext = format ["%1 / %2", _tin1text, _tin2text];
format [localize "str_player_31", _tintext, localize "str_player_31_fill"] call dayz_rollingMessages;
a_player_boil = false;
dayz_actionInProgress = false;
};
scopeName "main";
if (_qty > 0) then {
[player,(getPosATL player),10,"cook"] spawn fnc_alertZombies;
[player, (getPosATL player), 10, "cook"] spawn fnc_alertZombies;
_finished = ["Medic",1] call fn_loopAction;
// Double check player did not drop item
_bottles = [];
local _bottles = [];
{
if (_x in _waterbottles) then {
_bottles set [count _bottles, _x];
@@ -47,17 +47,22 @@ if (_qty > 0) then {
if (_qty < 1 || !_finished) exitWith {};
{
_bottle = _x;
player removeMagazine _bottle;
if (dayz_waterBottleBreaking && {[0.1] call fn_chance}) then {
if (_bottle in _platicBottles) then {
local _bottle = _x;
local _removed = [player, _bottle] call BIS_fnc_invRemove;
if (_removed == 0) then {
_finished = false;
breakTo "main";
};
if (dayz_waterBottleBreaking && {[DZE_bottleBreakChance] call fn_chance}) then {
if (_bottle in _plasticBottles) then {
player addMagazine "ItemPlasticWaterbottleDmg";
} else {
player addMagazine "ItemWaterBottleDmg";
};
localize "str_waterbottle_broke" call dayz_rollingMessages;
} else {
if (_bottle in _platicBottles) then {
if (_bottle in _plasticBottles) then {
if (_bottle in ["ItemPlasticWaterBottleInfected","ItemPlasticWaterBottleSafe"]) then {
player addMagazine "ItemPlasticWaterbottleBoiled";
} else {
@@ -72,9 +77,18 @@ if (_qty > 0) then {
};
};
} count _bottles;
format [localize "str_player_boiledwater",_qty] call dayz_rollingMessages;
format [localize "str_player_boiledwater", _qty] call dayz_rollingMessages;
} else {
format[localize "str_player_31",_bottletext,localize "str_player_31_fill"] call dayz_rollingMessages;
format [localize "str_player_31", _bottleText, localize "str_player_31_fill"] call dayz_rollingMessages;
};
if (!_finished) then {
localize "STR_EPOCH_ACTION_CANCELED" call dayz_rollingMessages;
} else {
if (_wasStanding) then {
player playActionNow "PlayerStand"; // once the action has completed, return player to a standing pose if they were standing before the action
};
};
a_player_boil = false;

View File

@@ -1,41 +1,49 @@
if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;};
dayz_actionInProgress = true;
private ["_rawmeat","_cookedmeat","_meat","_meatcooked","_text","_qty","_finished"];
//diag_log ("Cook Enabled");
player removeAction s_player_boil;
player removeAction s_player_cook;
s_player_cook = -1;
player removeAction s_player_thaw;
a_player_cooking = true;
//s_player_cook = -1;
_rawmeat = Dayz_meatraw;
_cookedmeat = Dayz_meatcooked;
a_player_cooking = true;
_finished = true;
local _wasStanding = ["perc", animationState player] call fnc_inString;
local _finished = true;
scopeName "main";
{
_meat = _x;
_meatcooked = _cookedmeat select (_rawmeat find _meat);
local _meat = _x;
local _meatcooked = Dayz_meatcooked select (Dayz_meatraw find _meat);
if (_meat in magazines player) then {
_text = getText (configFile >> "CfgMagazines" >> _meat >> "displayName");
[player,(getPosATL player),10,"cook"] spawn fnc_alertZombies;
local _text = getText (configFile >> "CfgMagazines" >> _meat >> "displayName");
[player, (getPosATL player), 10, "cook"] spawn fnc_alertZombies;
_finished = ["Medic",1] call fn_loopAction;
if (!_finished) exitWith {};
_qty = {_x == _meat} count magazines player;
if (!_finished) then {breakTo "main";};
for "_x" from 1 to _qty do {
player removeMagazine _meat;
local _qty = {_x == _meat} count magazines player;
for "_j" from 1 to _qty do {
local _removed = [player, _meat] call BIS_fnc_invRemove;
if (_removed == 0) then {
_finished = false;
breakTo "main";
};
player addMagazine _meatcooked;
// "xMeat must be in your main inventory to cook it" - Doesn't make sense here since meat was already cooked successfully.
if !(_meat in magazines player) exitWith {};
};
format[localize "str_success_cooked",_qty,_text] call dayz_rollingMessages;
format [localize "str_success_cooked", _qty, _text] call dayz_rollingMessages;
};
} forEach Dayz_meatraw;
if (!_finished) exitWith {};
} forEach _rawmeat;
if (!_finished) then {
localize "STR_EPOCH_ACTION_CANCELED" call dayz_rollingMessages;
} else {
if (_wasStanding) then {
player playActionNow "PlayerStand"; // once the action has completed, return player to a standing pose if they were standing before the action
};
};
a_player_cooking = false;
dayz_actionInProgress = false;

View File

@@ -6,11 +6,12 @@ if (isNull _body) exitWith {dayz_actionInProgress = false; systemChat localize "
if (_body getVariable["meatHarvested",false]) exitWith {dayz_actionInProgress = false;}; // Exit the script if the meat has already been harvested.
if ({isPlayer _x} count ((getPosATL _body) nearEntities ["CAManBase", 12]) > 1) exitWith {dayz_actionInProgress = false;localize "str_pickup_limit_5" call dayz_rollingMessages;}; // Exit the script if another player is near to prevent duping.
local _type = typeOf _body;
local _isZombie = _type isKindOf "zZombie_base";
local _isMutant = _type == "z_bloodsucker";
local _knives = [];
local _string = "";
local _type = typeOf _body;
local _isZombie = _type isKindOf "zZombie_base";
local _isMutant = _type == "z_bloodsucker";
local _knives = [];
local _string = "";
local _wasStanding = ["perc", animationState player] call fnc_inString;
// Count how many knives the player has
{
@@ -46,7 +47,7 @@ local _qty = if (_isListed) then {getNumber (configFile >> "CfgSurvival" >> "Mea
if ((_knives select 0) == "ItemKnifeBlunt") then {_qty = round(_qty / 2);};
if (local _body) then {
[_body,_qty] spawn local_gutObject; //leave as spawn (sleeping in loops will work but can freeze the script)
[_body, _qty] spawn local_gutObject; //leave as spawn (sleeping in loops will work but can freeze the script)
} else {
PVCDZ_obj_GutBody =[_body,_qty];
publicVariable "PVCDZ_obj_GutBody";
@@ -54,19 +55,21 @@ if (local _body) then {
["knives",0.2] call fn_dynamicTool;
if (_wasStanding) then {player playActionNow "PlayerStand";}; // once the action has completed, return player to a standing pose if they were standing before the action
call {
if (_isZombie) exitWith {
// Reduce humanity for gutting zeds
local _humanity = player getVariable ["humanity",0];
player setVariable ["humanity",(_humanity - 10),true];
_string = format[localize "str_success_gutted_zombie",_text]; //%1 has been gutted, zombie parts are now on the carcass
local _humanity = player getVariable ["humanity", 0];
player setVariable ["humanity", (_humanity - 10), true];
_string = format [localize "str_success_gutted_zombie", _text]; // %1 has been gutted, zombie parts are now on the carcass
};
if (_isMutant) exitWith {
_string = format[localize "str_success_gutted_mutant",_text];
_string = format [localize "str_success_gutted_mutant", _text];
};
_string = format[localize "str_success_gutted_animal",_text,_qty]; // default is gut animal
_string = format [localize "str_success_gutted_animal", _text, _qty]; // default is gut animal
};
closeDialog 0;

View File

@@ -1,36 +1,37 @@
if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;};
dayz_actionInProgress = true;
private ["_qty","_finished","_qty20","_qty5","_qty210","_magazines","_cursorTarget","_fuelAmount","_fuelNeeded"];
player removeAction s_player_fillfuel;
//s_player_fillfuel = -1;
_cursorTarget = _this select 3;
_magazines = magazines player;
local _cursorTarget = _this select 3;
local _magazines = magazines player;
local _wasStanding = ["perc", animationState player] call fnc_inString;
local _finished = true;
//Limit Fuel in tankers
_fuelAmount = _cursorTarget getVariable "FuelAmount";
// Limit Fuel in tankers
local _fuelAmount = _cursorTarget getVariable "FuelAmount";
if (isNil "_fuelAmount") then {
_fuelAmount = floor(Random dayz_randomMaxFuelAmount) max (dayz_randomMaxFuelAmount * 0.10);
_cursorTarget setVariable ["FuelAmount",_fuelAmount,true];
_fuelAmount = floor(random dayz_randomMaxFuelAmount) max (dayz_randomMaxFuelAmount * 0.10);
_cursorTarget setVariable ["FuelAmount", _fuelAmount, true];
};
_qty5 = {_x == "ItemFuelcanEmpty"} count _magazines;
_qty20 = {_x == "ItemJerrycanEmpty"} count _magazines;
_qty210 = {_x == "ItemFuelBarrelEmpty"} count _magazines;
_qty = _qty5 + _qty20 + _qty210;
local _qty5 = {_x == "ItemFuelcanEmpty"} count _magazines;
local _qty20 = {_x == "ItemJerrycanEmpty"} count _magazines;
local _qty210 = {_x == "ItemFuelBarrelEmpty"} count _magazines;
local _qty = _qty5 + _qty20 + _qty210;
_fuelNeeded = (_qty5 * 5) + (_qty20 * 20) + (_qty210 * 210);
local _fuelNeeded = (_qty5 * 5) + (_qty20 * 20) + (_qty210 * 210);
//Inform if there is not enough to fill all containers in inventory, then proceed to fill available containers
if (_fuelAmount < _fuelNeeded) then {format[localize "str_fill_notenough",_fuelAmount,_fuelNeeded] call dayz_rollingMessages;};
// Inform if there is not enough to fill all containers in inventory, then proceed to fill available containers
if (_fuelAmount < _fuelNeeded) then {format [localize "str_fill_notenough", _fuelAmount, _fuelNeeded] call dayz_rollingMessages;};
//If there is not enough to fill any of their cans then exit
// If there is not enough to fill any of their cans then exit
if (_fuelAmount < 5 or (_fuelAmount < 20 && _qty5 == 0) or (_fuelAmount < 210 && (_qty5 == 0 && _qty20 == 0))) exitWith {dayz_actionInProgress = false;};
scopeName "main";
if (_qty > 0) then {
[player,(getPosATL player),20,"refuel"] spawn fnc_alertZombies;
[player, (getPosATL player), 20, "refuel"] spawn fnc_alertZombies;
_finished = ["Medic",1] call fn_loopAction;
if (!_finished) exitWith {};
@@ -38,47 +39,68 @@ if (_qty > 0) then {
// Added Nutrition-Factor for work
["Working",0,[20,40,15,0]] call dayz_NutritionSystem;
for "_x" from 1 to _qty5 do {
for "_j" from 1 to _qty5 do {
_fuelAmount = _cursorTarget getVariable "FuelAmount";
if (_fuelAmount >= 5) then {
_fuelAmount = _fuelAmount - 5;
_cursorTarget setVariable ["FuelAmount",_fuelAmount,true];
player removeMagazine "ItemFuelcanEmpty";
_cursorTarget setVariable ["FuelAmount", _fuelAmount, true];
local _removed = [player, "ItemFuelcanEmpty", 1] call BIS_fnc_invRemove;
if (_removed == 0) then {
_finished = false;
breakTo "main";
};
player addMagazine "ItemFuelcan";
} else {
_qty = _qty - 1;
};
};
for "_x" from 1 to _qty20 do {
for "_j" from 1 to _qty20 do {
_fuelAmount = _cursorTarget getVariable "FuelAmount";
if (_fuelAmount >= 20) then {
_fuelAmount = _fuelAmount - 20;
_cursorTarget setVariable ["FuelAmount",_fuelAmount,true];
player removeMagazine "ItemJerrycanEmpty";
_cursorTarget setVariable ["FuelAmount", _fuelAmount, true];
local _removed = [player, "ItemJerrycanEmpty", 1] call BIS_fnc_invRemove;
if (_removed == 0) then {
_finished = false;
breakTo "main";
};
player addMagazine "ItemJerrycan";
} else {
_qty = _qty - 1;
};
};
for "_x" from 1 to _qty210 do {
for "_j" from 1 to _qty210 do {
_fuelAmount = _cursorTarget getVariable "FuelAmount";
if (_fuelAmount >= 210) then {
_fuelAmount = _fuelAmount - 210;
_cursorTarget setVariable ["FuelAmount",_fuelAmount,true];
player removeMagazine "ItemFuelBarrelEmpty";
_cursorTarget setVariable ["FuelAmount", _fuelAmount, true];
local _removed = [player, "ItemFuelBarrelEmpty", 1] call BIS_fnc_invRemove;
if (_removed == 0) then {
_finished = false;
breakTo "main";
};
player addMagazine "ItemFuelBarrel";
} else {
_qty = _qty - 1;
};
};
//format[localize "str_player_09",_qty] call dayz_rollingMessages;
format[localize "str_fill_success",_qty,typeOf _cursorTarget,_fuelAmount] call dayz_rollingMessages;
//diag_log format[localize "str_fill_success",_qty,typeOf _cursorTarget,_fuelAmount];
format [localize "str_fill_success", _qty, _fuelAmount] call dayz_rollingMessages;
} else {
localize "str_player_10" call dayz_rollingMessages;
};
if (!_finished) then {
localize "STR_EPOCH_ACTION_CANCELED" call dayz_rollingMessages;
} else {
if (_wasStanding) then {
player playActionNow "PlayerStand"; // once the action has completed, return player to a standing pose if they were standing before the action
};
};
dayz_actionInProgress = false;