Epoch/Sources/epoch_code/compile/functions/EPOCH_giveAttributes.sqf
vbawol 05bbb9a14e 0.3.9.0539
add loot class override variable epochLootClass, to allow all zed
classes to return
BE filter updates for extra zombie classes
added loot table for zombies.
added looting of Dogs for meat with negative karma.
cooking of dog meat.
loot configs for shark
interactAttributes format changed to an array ["Hunger",100,1] //
CustomVarName, value, make value randomized.
BE updates and fixes
new function EPOCH_giveAttributes
2016-06-23 20:43:22 -05:00

35 lines
1.5 KiB
Plaintext

// EPOCH_giveAttributes
private ["_return","_addPlus","_editableVars","_selectedVar","_varName","_celcuis","_celcuisNew","_customVarIndex","_limits","_currentVal","_newValue"];
params ["_selectedVarName",["_data",0],["_randomizeData",0]];
_addPlus = if (_data > 0) then {"+"} else {""};
_return = "";
if (_data != 0) then {
_customVarIndex = EPOCH_customVars find _selectedVarName;
if (_customVarIndex != -1) then {
_varName = format["EPOCH_player%1",_selectedVarName];}
_limits = EPOCH_customVarLimits select _customVarIndex;
_limits params [["_max",100],["_min",0]];
if (_max isEqualType "") then {
_max = missionNamespace getVariable [_max, 0];
};
if (_min isEqualType "") then {
_min = missionNamespace getVariable [_min, 0];
};
_currentVal = missionNamespace getVariable [_varName, EPOCH_defaultVars select _customVarIndex];
if (_randomizeData isEqualTo 1) then {
_data = round(random _data);
};
_newValue = ((_currentVal + _data) min _max) max _min;
missionNamespace setVariable [_varName, _newValue];
if (_selectedVarName == "Temp") then {
_celcuis = _data call EPOCH_convertTemp;
_celcuisNew = _newValue call EPOCH_convertTemp;
_return = format["%1: %2%3 (%4 °F) %2%5 (%6 °C)",(localize format["str_epoch_pvar_%1",_selectedVarName]),_addPlus,_data,_newValue,_celcuis,_celcuisNew];
} else {
_return = format["%1: %2%3 (%4/%5)", (localize format["str_epoch_pvar_%1",_selectedVarName]), _addPlus, _data, _newValue, _max];
};
};
};
_return