Search the Community
Showing results for tags 'not defined'.
Found 1 result
-
Variable not defined when using local variable
SSgt 'Ice Cold' Sykes posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hi, I'm trying to set up a minefield module via script. I get an error when using local variables while everything works fine with global variables. If anyone could tell why that'd be great. Here's my code : POP_fnc_Minefield = { if ((typename _this != "ARRAY") or (count _this < 3)) exitWith {hint format ["Error : POP_fnc_Minefield argument : %1", _this];}; _MineGroup = createGroup [(_this select 0), true]; _pos = _this select 1; _FieldSize = _this select 2; if (count _this <= 3) then {_NbMines = floor(_FieldSize/2);} else {_NbMines = floor(_FieldSize/2*(_this select 3));}; if (count _this <= 4) then {_MineType = "APERSMine";} else {_MineType = this select 4;}; if (count _this <= 5) then {_FieldCond = TRUE;} else {_FieldCond = _this select 5;}; _Minefield = "Site_Minefield" createUnit [ _pos, _MineGroup, format [ "this setVariable ['minescount', '%1']; this setVariable ['minestype', '%2']; this setVariable ['axisa', '%3']; this setVariable ['axisb', '%3']; this setVariable ['shape', 'Rectangle']; this setVariable ['side', 'Independent']; this setVariable ['marked', 'Friendlies']; this setVariable ['conditionofpresence', '%4'];", _NbMines, _MineType, _FieldSize, _FieldCond ] ]; }; This code throws undefined variable errors but if replace _NbMines, _MineType, _FieldCond with NbMines, MineType, FieldCond then everything seems to work fine.- 3 replies
-
- variable
- not defined
-
(and 2 more)
Tagged with: