player stats fixes part 6

This commit is contained in:
vbawol 2017-09-27 10:38:18 -05:00
parent 0ad1a967d8
commit 8f1b71a26e
4 changed files with 6 additions and 3 deletions

View File

@ -23,7 +23,7 @@
Returns:
NUMBER
*/
params ["_key","_change","_max","_min"];
params [["_key","",[""]],["_change",0],["_max",100],["_min",0]];
private _result = (((missionNamespace getVariable [_key, 0]) + _change) min _max) max _min;
missionNamespace setVariable [_key, _result];
_result

View File

@ -330,7 +330,7 @@ if !(EPOCH_ActiveTraderMission isequalto []) then {
};
// Update read only vars
EPOCH_playerEnergy = missionNamespace getVariable [_playerEnergyKey, 0];
EPOCH_playerEnergy = missionNamespace getVariable [_playerEnergyKey, _playerEnergynDefault];
// force update
if (EPOCH_forceUpdateNow) then {

View File

@ -175,6 +175,7 @@ if (_wet) then {
// Hunger / Thirst
_hungerlossRate = _baseHungerLoss * timeMultiplier;
_thirstlossRate = _baseThirstLoss * timeMultiplier;
_alcoholLossRate = _baseAlcoholLoss * timeMultiplier;
// Increase hunger if player is Fatigued
_playerStamina = missionNamespace getVariable [_playerStaminaKey, _playerStaminaDefault];

View File

@ -50,6 +50,7 @@ _customVarLimits = _customVarsInit apply {_x param [2,[]]};
(_customVarLimits select (_customVarNames find "Nuisance")) params [["_playerNuisanceMax",100],["_playerNuisanceMin",0]];
(_defaultVarValues select (_customVarNames find "Nuisance")) params [["_playerNuisanceDefault",0]];
(_defaultVarValues select (_customVarNames find "AliveTime")) params [["_playerAliveTimeDefault",0]];
(_defaultVarValues select (_customVarNames find "HitPoints")) params [["_playerHitPointsDefault",0]];
(_defaultVarValues select (_customVarNames find "SpawnArray")) params [["_playerSpawnArrayDefault",0]];
(_defaultVarValues select (_customVarNames find "MissionArray")) params [["_playerMissionArrayDefault",0]];
@ -111,7 +112,7 @@ _prevEquippedItem = [];
_damagePlayer = damage player;
_isOnFoot = isNull objectParent player;
_panic = false;
_prevEnergy = _playerEnergy;
_prevEnergy = missionNamespace getVariable [_playerEnergyKey, _playerEnergynDefault];
// init config data
@ -119,6 +120,7 @@ _antagonistRndChance = ["CfgEpochClient", "antagonistRngChance", 100] call EPOCH
_baseHungerLoss = ["CfgEpochClient", "baseHungerLoss", 2] call EPOCH_fnc_returnConfigEntryV2;
_baseThirstLoss = ["CfgEpochClient", "baseThirstLoss", 2] call EPOCH_fnc_returnConfigEntryV2;
_baseAlcoholLoss = ["CfgEpochClient", "baseAlcoholLoss", 0.17] call EPOCH_fnc_returnConfigEntryV2;
_energyCostNV = ["CfgEpochClient", "energyCostNV", 3] call EPOCH_fnc_returnConfigEntryV2;
_energyRegenMax = ["CfgEpochClient", "energyRegenMax", 5] call EPOCH_fnc_returnConfigEntryV2;
_energyRange = ["CfgEpochClient", "energyRange", 75] call EPOCH_fnc_returnConfigEntryV2;