Welcome to the Iron Front Fan Forums!
Sign up Latest Topics
 
 
 


Reply
  Author   Comment  
Haz

Sergeant
Registered:
Posts: 89
Reply with quote  #1 
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;
_unit1Type = _WESTtroopsArray select (floor(random(count _WESTtroopsArray)));
_unit1 = _milGroup createUnit [_unit1Type, _centerPos, [], 0, "NONE"];
_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
0
kju

RM Team
Registered:
Posts: 388
Reply with quote  #2 
_centerPos seems undefined/empty array.
0
Haz

Sergeant
Registered:
Posts: 89
Reply with quote  #3 
Thanks.

Dirty Haz

Edit/Update: I think I have fixed that but now I am getting another similar error...
Error 1 elements provided, 3 expected


Dirty Haz
0
kju

RM Team
Registered:
Posts: 388
Reply with quote  #4 
[[x,y,z]] => [x,y,z]
0
Haz

Sergeant
Registered:
Posts: 89
Reply with quote  #5 
Solved.
_centerPos = getMarkerPos (_this select 0);


Dirty Haz
0
Gunter Severloh

Avatar / Picture

Admin
Registered:
Posts: 2,759
Reply with quote  #6 
Even though you asked Dirty haz I knew you would figure it out, and Kju would respond back and tell you whats wrong or give you an idea.
Great job!

__________________
0
Haz

Sergeant
Registered:
Posts: 89
Reply with quote  #7 
@kju - Thank you!
@Gunter Severloh - Saved by kju!
I will be releasing a updated version of my militarize(.sqf) script later today or tomorrow along with a example mission. The new version will have parameters in calling line and some other stuff which I have not yet thought of lol...

Dirty Haz
0
Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.