I am working on a script that will on server start randomly place (from an array of options) several buildings on the map. I am currently testing with a few buildings on the southern coast of Chernarus and they themselves will spawn from the normal sqf file but when I try to take their classnames, coords, and setdir and put them into an array I can't seem to call them properly. Any assistance would be appreciated. The code I have so far and the error I am getting in my rpt file are below.
Code
/* Random Building Spawn for Chernarus - By Phyrstorm Usage [building,coords,dir] Building is the Building class name Coords are the coords from your custom mission file direction is the setDir from your mission file */ private ["_building","_coords","_dir","_count","_buildarray"]; if (!isServer) exitWith {}; _building = "Land_Mil_Barracks_i"; _coords = [3363.9216, 2167.3716, 2.3841858e-006]; _dir = -132.08899; _count = 3; //_buildarray usage [building,coords,dir] _buildarray = [ ["Land_Mil_Barracks_i",[3363.9216, 2167.3716, 2.3841858e-006],-132.08899], ["Land_Mil_Barracks_i",[3370.8013, 2173.6431, 6.1988831e-006],-132.08899], ["Land_Mil_Barracks_i",[3377.9146, 2180.3911, 9.5367432e-007],-132.08899], ["Land_Mil_Barracks_i",[3385.0901, 2186.7957, 6.6757202e-006],-132.08899], ["Land_Mil_Barracks_i",[3392.9038, 2194.2275, 6.1988831e-006],-132.08899], ["Land_Mil_Barracks_i",[3400.0671, 2200.752, 4.2915344e-006],-132.08899] ]; for "_x" from 1 to _count do { _buildrand = _buildarray call BIS_fuc_selectRandom; _buildarray = _buildarray - _buildrand; _building = _buildrand select 0; _coords = _buildrand select 1; _dir = _buildrand select 2; _vehicle = objNull; if (true) then { _this = createVehicle [_building, _coords, [], 0, "CAN_COLLIDE"]; _vehicle = _this; _this setDir _dir; _this setPos _coords; }; diag_log text format ["%1 spawned at %2 facing %3.",_building,_coords,_dir]; };
RPT grab
23:59:30 Error in expression <cle = objNull;if (true) then { _this = createVehicle [_building, _coords, [], 0> 23:59:30 Error position: <createVehicle [_building, _coords, [], 0> 23:59:30 Error Type Any, expected String 23:59:30 File mpmissions\DayZ_OverPoch_1.Chernarus\buildings\randtest.sqf, line 39 23:59:30 any spawned at any facing any. 23:59:30 Error in expression <cle = objNull; if (true) then { _this = createVehicle [_building, _coords, [], 0> 23:59:30 Error position: <createVehicle [_building, _coords, [], 0> 23:59:30 Error Type Any, expected String 23:59:30 File mpmissions\DayZ_OverPoch_1.Chernarus\buildings\randtest.sqf, line 39 23:59:30 any spawned at any facing any. 23:59:30 Error in expression <cle = objNull; if (true) then { _this = createVehicle [_building, _coords, [], 0> 23:59:30 Error position: <createVehicle [_building, _coords, [], 0> 23:59:30 Error Type Any, expected String 23:59:30 File mpmissions\DayZ_OverPoch_1.Chernarus\buildings\randtest.sqf, line 39 23:59:30 any spawned at any facing any.