mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
29 lines
732 B
Plaintext
29 lines
732 B
Plaintext
|
/**
|
||
|
* fn_setVariable.sqf
|
||
|
* @Descr: Setvariable value
|
||
|
* @Author: Glowbal
|
||
|
*
|
||
|
* @Arguments: [unit OBJECT, variableName STRING, value ANY]
|
||
|
* @Return: void
|
||
|
* @PublicAPI: true
|
||
|
*/
|
||
|
|
||
|
private ["_unit","_variable","_value","_update","_global","_definedVariable","_defaultGlobal","_currentValue"];
|
||
|
_unit = _this select 0;
|
||
|
_variable = _this select 1;
|
||
|
_value = _this select 2;
|
||
|
_global = false;
|
||
|
|
||
|
if (count _this > 3) then {
|
||
|
_global = _this select 3;
|
||
|
} else {
|
||
|
_definedVariable = ([_variable] call cse_fnc_getVariableInfo);
|
||
|
if (count _definedVariable > 2) then {
|
||
|
_global = _definedVariable select 2;
|
||
|
};
|
||
|
};
|
||
|
|
||
|
if (!isNil "_value") exitwith {
|
||
|
_unit setvariable [_variable, _value, _global];
|
||
|
};
|
||
|
_unit setvariable [_variable, nil, _global];
|