2015-01-16 23:21:47 +00:00
|
|
|
/**
|
|
|
|
* fn_setVariable.sqf
|
|
|
|
* @Descr: Setvariable value
|
|
|
|
* @Author: Glowbal
|
|
|
|
*
|
|
|
|
* @Arguments: [unit OBJECT, variableName STRING, value ANY]
|
|
|
|
* @Return: void
|
|
|
|
* @PublicAPI: true
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-05-14 22:17:41 +00:00
|
|
|
private ["_global","_definedVariable"];
|
2015-05-14 18:06:06 +00:00
|
|
|
|
|
|
|
PARAMS_3(_unit,_variable,_value);
|
|
|
|
|
2015-01-16 23:21:47 +00:00
|
|
|
_global = false;
|
|
|
|
|
|
|
|
if (count _this > 3) then {
|
2015-01-18 19:09:19 +00:00
|
|
|
_global = _this select 3;
|
2015-01-16 23:21:47 +00:00
|
|
|
} else {
|
2015-01-18 19:09:19 +00:00
|
|
|
_definedVariable = ([_variable] call FUNC(getDefinedVariableInfo));
|
|
|
|
if (count _definedVariable > 2) then {
|
|
|
|
_global = _definedVariable select 2;
|
|
|
|
};
|
2015-01-16 23:21:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
if (!isNil "_value") exitwith {
|
2015-01-18 19:09:19 +00:00
|
|
|
_unit setvariable [_variable, _value, _global];
|
2015-01-16 23:21:47 +00:00
|
|
|
};
|
|
|
|
_unit setvariable [_variable, nil, _global];
|