Jump to content
Sign in to follow this  
HazJ

Error select: 0 elements provided, 3 expected

Recommended Posts

Code in red in causing the error(s) but have no clue why...

// by SPUn aka LostVar and Dirty Haz

private ["_centerPos","_side","_troops","_vehicles","_troopAmount","_vehicleAmount","_radius","_still","_WESTtroopsArray","_WESTvehiclesArray","_EASTtroopsArray","_EASTvehiclesArray","_milHQ","_milGroup","_unit1","_vehicle"];

// Parameters
_centerPos = _this select 0;
_side = if (count _this > 1) then {_this select 1;} else {2;};
_troops = _this select 2;
_vehicles = _this select 3;
_troopAmount = _this select 4;
_vehicleAmount = _this select 5;
_radius = _this select 6;
_still = _this select 7;


_WESTtroopsArray = ["SG_sturmtrooper_unterofficer","SG_sturmtrooper_smgunner","SG_sturmtrooper_mgunner","SG_sturmtrooper_medic","SG_sturmtrooper_AT_soldier","SG_sturmtrooper_rifleman"];
_WESTvehiclesArray = ["LIB_StuG_III_G","LIB_PzKpfwV","LIB_PzKpfwVI_B_camo"];
_EASTtroopsArray = ["LIB_SOV_sergeant","LIB_SOV_smgunner","LIB_SOV_mgunner","LIB_SOV_medic","LIB_SOV_AT_grenadier","LIB_SOV_LC_rifleman"];
_EASTvehiclesArray = ["LIB_JS2_43","LIB_t34_76","LIB_t34_85"];

switch (_side) do {
case 1: {
_milHQ = createCenter west;
if(isNil("_milGroup"))then{_milGroup = createGroup west;}else{_milGroup = east;};
_troopArray = _WESTtroopsArray;
_vehArray = _WESTvehiclesArray;
}; 
case 2: {
_milHQ = createCenter east;
if(isNil("_milGroup"))then{_milGroup = createGroup east;}else{_milGroup = west;};
_troopArray = _EASTtroopsArray;
_vehArray = _EASTvehiclesArray;
};
};

if (_troops) then {
_mi = 1;
while {_mi < _troopAmount} do {
_mi = _mi + 1;
_dir = random 360;
_range = random _radius;
[b][color="#FF0000"]_unit1Type = _WESTtroopsArray select (floor(random(count _WESTtroopsArray)));
_unit1 = _milGroup createUnit [_unit1Type, _centerPos, [], 0, "NONE"];[/color][/b]
_unit1 setPos [(_centerPos select 0) + (sin _dir) * _range, (_centerPos select 1) + (cos _dir) * _range, 0];
_unit1 setUnitPos "UP";
_unit1 setSkill ["aimingAccuracy", 1];
_unit1 setSkill ["spotDistance", 1];
_unit1 setSkill ["spotTime", 1];
_unit1 setSkill ["courage", 1];
_unit1 setSkill ["commanding", 1];
_unit1 setSkill ["aimingShake", 1];
_unit1 setSkill ["aimingSpeed", 1];
if (!_still) then {
_patrolType = random 6;
if (_patrolType > 4) then {
_unit1 setVehicleInit "pat = [this] execVM 'patrol-vA.sqf';";
}else{
_unit1 setVehicleInit "pat = [this] execVM 'patrol-vC.sqf';";
};
processInitCommands;
};
};
};

if (_vehicles) then {
_mi = 1;
while {_mi < _vehicleAmount} do {
_mi = _mi + 1;
_dir = random 360;
_range = random _radius;
_center = createCenter west;
_grp = createGroup west;
{
_vehicle = createVehicle [_x, _centerPos, [], 0, "NONE"];
_vCrew = [_vehicle, _grp] call BIS_fnc_spawnCrew;
} forEach _vehiclesArray;
_vehicle setPos [(_centerPos select 0) + (sin _dir) * _range, (_centerPos select 1) + (cos _dir) * _range, 1];
_vehicle setUnitPos "UP";
_vehicle setSkill ["aimingAccuracy", 1];
_vehicle setSkill ["spotDistance", 1];
_vehicle setSkill ["spotTime", 1];
_vehicle setSkill ["courage", 1];
_vehicle setSkill ["commanding", 1];
_vehicle setSkill ["aimingShake", 1];
_vehicle setSkill ["aimingSpeed", 1];
if (!_still) then {
_patrolType = random 6;
if( _patrolType > 4) then {
_vehicle setVehicleInit "pat = [this] execVM 'patrol-vA.sqf';";
}else{
_vehicle setVehicleInit "pat = [this] execVM 'patrol-vC.sqf';";
};
processInitCommands;
};
};
};

Dirty Haz

Edit/Update: Solved! Solution here.

Dirty Haz

Edited by Dirty Haz
Edit/Update

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×