Jump to content
  • 0

Looking to fix the food/drink decreasing too quick [SOLVED]


Neurok_

Question

15 answers to this question

Recommended Posts

  • 0

It seems that whenever you use a hatchet, for tree cutting or zombie cutting, the food and water use increases exponentially, no matter what you set the variable to. I think it even continues until you switch weapons, so it seems to have an effect just being equipped. This is on a new, fresh 1.0.6.1 server.

Link to comment
Share on other sites

  • 0

there's actually an error which results in food and drink being used too fast. You can actually fix this yourself in your mission's init.sqf by placing this following block of code, immediately below the Line: call compile preprocessFileLineNumbers "\z\addons\dayz_code\init\compiles.sqf";

dayz_NutritionSystem = {
	private ["_type","_baseRegen","_nutrition","_calorieCount","_hungerCount","_thirstCount","_tempCount","_Thirst","_Hunger","_bloodregen","_golbalNutrition"];
	_type = _this select 0;
	_baseRegen = _this select 1;
	_nutrition = _this select 2;
	_calorieCount = ((_this select 2) select 0);
	_hungerCount = ((_this select 2) select 1);
	_thirstCount = ((_this select 2) select 2);
	_tempCount = ((_this select 2) select 3);
	if (_calorieCount > 0) then {
		_hungerCount = _hungerCount + (SleepFood * (((ln ((_calorieCount / 3610) * 100)) * (1 - (dayz_hunger / SleepFood))) / 100));
		_thirstCount = _thirstCount + (SleepWater * (((ln ((_calorieCount / 3610) * 100)) * (1 - (dayz_thirst / SleepWater))) / 100));
	};
	switch (_type) do {
		case "FoodDrink": {
			if (_hungerCount > 0) then { 
				if (dayz_hunger > _hungerCount) then {
					dayz_hunger = dayz_hunger - (_hungerCount);  
				} else {
					dayz_hunger = 0;
				};
			};
			if (_thirstCount > 0) then { 
				if (dayz_thirst > _thirstCount) then {
					dayz_thirst = dayz_thirst - _thirstCount;
				} else {
					dayz_thirst = 0;
				};
			};
			if (_tempCount > 0) then { dayz_temperatur = dayz_temperatur + _tempCount; };
			if (_calorieCount > 0) then { dayz_nutrition = dayz_nutrition + _calorieCount; };
			if (_baseRegen > 0) then { r_player_bloodregen = r_player_bloodregen + _baseRegen; };
		};
		case "Working": {
			if (_calorieCount > 0) then { dayz_nutrition = dayz_nutrition - (_calorieCount / ((DZE_NutritionDivisor select 0) max 0.1)); };
			if (_thirstCount > 0) then { dayz_thirst = dayz_thirst + (_thirstCount / ((DZE_NutritionDivisor select 1) max 0.1)); };
			if (_hungerCount > 0) then { dayz_hunger = dayz_hunger + (_hungerCount / ((DZE_NutritionDivisor select 2) max 0.1)); };
			if (_tempCount > 0) then { dayz_temperatur = dayz_temperatur + (_tempCount / ((DZE_NutritionDivisor select 3) max 0.1)); };
		};
	
	};
	dayz_thirst = (dayz_thirst min SleepWater) max 0;
	dayz_hunger = (dayz_hunger min SleepFood) max 0;
	dayz_temperatur = (dayz_temperatur min dayz_temperaturmax) max dayz_temperaturmin;
};

 

Link to comment
Share on other sites

  • 0

Can you put that in a custom compiles thats called after the server one like so?

Spoiler

if (isServer) then {
    diag_log "Loading custom server compiles";    
};

if (!isDedicated) then {
    diag_log "Loading custom client compiles";
    
    fnc_usec_selfactions = compile preprocessFileLineNumbers "dayz_code\compile\fn_selfActions.sqf";
 

dayz_NutritionSystem = {
    private ["_type","_baseRegen","_nutrition","_calorieCount","_hungerCount","_thirstCount","_tempCount","_Thirst","_Hunger","_bloodregen","_golbalNutrition"];
    _type = _this select 0;
    _baseRegen = _this select 1;
    _nutrition = _this select 2;
    _calorieCount = ((_this select 2) select 0);
    _hungerCount = ((_this select 2) select 1);
    _thirstCount = ((_this select 2) select 2);
    _tempCount = ((_this select 2) select 3);
    if (_calorieCount > 0) then {
        _hungerCount = _hungerCount + (SleepFood * (((ln ((_calorieCount / 3610) * 100)) * (1 - (dayz_hunger / SleepFood))) / 100));
        _thirstCount = _thirstCount + (SleepWater * (((ln ((_calorieCount / 3610) * 100)) * (1 - (dayz_thirst / SleepWater))) / 100));
    };
    switch (_type) do {
        case "FoodDrink": {
            if (_hungerCount > 0) then {
                if (dayz_hunger > _hungerCount) then {
                    dayz_hunger = dayz_hunger - (_hungerCount);  
                } else {
                    dayz_hunger = 0;
                };
            };
            if (_thirstCount > 0) then {
                if (dayz_thirst > _thirstCount) then {
                    dayz_thirst = dayz_thirst - _thirstCount;
                } else {
                    dayz_thirst = 0;
                };
            };
            if (_tempCount > 0) then { dayz_temperatur = dayz_temperatur + _tempCount; };
            if (_calorieCount > 0) then { dayz_nutrition = dayz_nutrition + _calorieCount; };
            if (_baseRegen > 0) then { r_player_bloodregen = r_player_bloodregen + _baseRegen; };
        };
        case "Working": {
            if (_calorieCount > 0) then { dayz_nutrition = dayz_nutrition - (_calorieCount / ((DZE_NutritionDivisor select 0) max 0.1)); };
            if (_thirstCount > 0) then { dayz_thirst = dayz_thirst + (_thirstCount / ((DZE_NutritionDivisor select 1) max 0.1)); };
            if (_hungerCount > 0) then { dayz_hunger = dayz_hunger + (_hungerCount / ((DZE_NutritionDivisor select 2) max 0.1)); };
            if (_tempCount > 0) then { dayz_temperatur = dayz_temperatur + (_tempCount / ((DZE_NutritionDivisor select 3) max 0.1)); };
        };
    
    };
    dayz_thirst = (dayz_thirst min SleepWater) max 0;
    dayz_hunger = (dayz_hunger min SleepFood) max 0;
    dayz_temperatur = (dayz_temperatur min dayz_temperaturmax) max dayz_temperaturmin;
};
};

 

Link to comment
Share on other sites

  • 0

I added the code to my init file just like you said and while it does help with consumption during regular activity, I am still using up all of it whenever i perform an action like using a sledgehammer or working on cars. I am always working on cars and I look up and am almost dead.

 

I have this code DZE_NutritionDivisor = [.1, .1, .1, .1]; placed in the config variables section of the init file, is that where it goes?

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...