2018-09-17 19:19:29 +00:00
|
|
|
#include "script_component.hpp"
|
2015-09-19 18:34:07 +00:00
|
|
|
/*
|
|
|
|
* Author: Glowbal
|
2015-11-30 16:53:57 +00:00
|
|
|
* setVariable value
|
2015-01-16 23:21:47 +00:00
|
|
|
*
|
2015-09-19 18:34:07 +00:00
|
|
|
* Arguments:
|
|
|
|
* 0: Unit <OBJECT>
|
|
|
|
* 1: variableName <STRING>
|
|
|
|
* 2: value <ANY>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
2017-06-08 13:31:51 +00:00
|
|
|
* Example:
|
|
|
|
* [bob, "var", 5] call ace_common_fnc_setDefinedVariable
|
|
|
|
*
|
2015-09-19 18:34:07 +00:00
|
|
|
* Public: Yes
|
2015-01-16 23:21:47 +00:00
|
|
|
*/
|
|
|
|
|
2015-09-19 18:34:07 +00:00
|
|
|
params ["_unit", "_variable", "_value", "_global"];
|
2015-05-14 18:06:06 +00:00
|
|
|
|
2015-09-19 18:34:07 +00:00
|
|
|
if (isNil "_global") then {
|
2015-12-14 12:08:19 +00:00
|
|
|
private _definedVariable = [_variable] call FUNC(getDefinedVariableInfo);
|
2015-05-14 18:06:06 +00:00
|
|
|
|
2015-09-19 18:34:07 +00:00
|
|
|
_definedVariable params ["", "", ["_global", false]];
|
2015-01-16 23:21:47 +00:00
|
|
|
};
|
|
|
|
|
2015-11-30 16:14:05 +00:00
|
|
|
if (!isNil "_value") exitWith {
|
2015-09-19 18:34:07 +00:00
|
|
|
_unit setVariable [_variable, _value, _global];
|
2015-01-16 23:21:47 +00:00
|
|
|
};
|
2015-09-19 18:34:07 +00:00
|
|
|
|
|
|
|
_unit setVariable [_variable, nil, _global];
|