ACE3/addons/common/functions/fnc_setDefinedVariable.sqf

31 lines
589 B
Plaintext
Raw Normal View History

2015-09-19 18:34:07 +00:00
/*
* Author: Glowbal
* 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
*
* Public: Yes
2015-01-16 23:21:47 +00:00
*/
#include "script_component.hpp"
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 {
private "_definedVariable";
_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
};
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];