private["_aiunit","_xpos","_ypos","_unitpos","_aiGroup","_wppos","_wpradius","_wpnum","_numunits","_rndLOut","_ailoadout","_aiwep","_aiammo","_wp","_aispawnpos"];
private["_aiunit","_xpos","_ypos","_unitpos","_aiGroup","_wppos","_wpradius","_wpnum","_numunits","_rndLOut","_ailoadout","_aiwep","_aiammo","_wp","_aispawnpos"];
_aiunit = objNull;
_aiGroup = createGroup EAST; // <----THIS MAKES THEM HATE PLAYERS!
_aispawnpos =_this select 0;
_wpradius = _this select 1;
_wpnum = _this select 2;
_numunits = _this select 3;
_xpos = _aispawnpos select 0;
_ypos = _aispawnpos select 1;
diag_log format ["AIUNIT: Spawn initiated: Centre:%1 | Radius in m:%2 | Waypoint number:%3",_aispawnpos,_wpradius,_wpnum];
for [{ x=1 },{ x < _numunits+1 },{ x = x + 1; }] do {
_unitpos = [_xpos+x,_ypos+x,0];
//Generate what the main weapon and ammo will be
_rndLOut=floor(random 27);
_ailoadout=
switch (_rndLOut) do
{
case 0: {["DMR","20Rnd_762x51_DMR"]};
case 1: {["M24","5Rnd_762x51_M24"]};
case 2: {["SVD_CAMO","10Rnd_762x54_SVD"]};
case 3: {["M40A3","5Rnd_762x51_M24"]};
case 4: {["M249_DZ","200Rnd_556x45_M249"]};
case 5: {["M240","100Rnd_762x51_M240"]};
case 6: {["Mk_48_DZ","100Rnd_762x51_M240"]};
case 7: {["Sa58V_EP1","30Rnd_762x39_SA58"]};
case 8: {["BAF_L85A2_RIS_Holo","30Rnd_556x45_Stanag"]};
case 9: {["G36C","30Rnd_556x45_G36"]};
case 10: {["M4A1_HWS_GL_camo","30Rnd_556x45_Stanag"]};
case 11: {["M16A4_ACG","30Rnd_556x45_Stanag"]};
case 12: {["G36A_camo","30Rnd_556x45_G36"]};
case 13: {["AK_47_M","30Rnd_762x39_AK47"]};
case 14: {["M16A2","30Rnd_556x45_Stanag"]};
case 15: {["FN_FAL","20Rnd_762x51_FNFAL"]};
case 16: {["M4A1","30Rnd_556x45_Stanag"]};
case 17: {["M4A1_AIM_SD_camo","30Rnd_556x45_StanagSD"]};
case 18: {["G36K_camo","30Rnd_556x45_G36"]};
case 19: {["AK_47_S","30Rnd_762x39_AK47"]};
case 20: {["VSS_Vintorez","20Rnd_9x39_SP5_VSS"]};
case 21: {["RPK_74","75Rnd_545x39_RPK"]};
case 22: {["PK","100Rnd_762x54_PK"]};
case 23: {["SVD","10Rnd_762x54_SVD"]};
case 24: {["AK_107_Kobra","30Rnd_545x39_AK"]};
case 25: {["ksvk","5Rnd_127x108_KSVK"]};
case 26: {["M4SPR","30Rnd_556x45_Stanag"]};
default {["ItemMap"]};
};
//Generate what the sidearm and ammo will be
_rndLOut=floor(random 3);
_aiside=
switch (_rndLOut) do
{
case 0: {["UZI_EP1","30Rnd_9x19_UZI"]};
case 1: {["MakarovSD","8Rnd_9x18_MakarovSD"]};
case 2: {["UZI_SD_EP1","30Rnd_9x19_UZI_SD"]};
};
//Generate what the equipment will be - it's likely to be antibiotics, but maybe.... :)
_rndLOut=floor(random 30);
_aiequipspawn=
switch (_rndLOut) do
{
case 0: {["Binocular_Vector"]};
case 1: {["ItemGPS"]};
case 2: {["ItemCompass"]};
case 3: {["NVGoggles"]};
case 4: {["Binocular"]};
};
"GUE_Soldier_Medic" createUnit [_unitpos, _aiGroup, "_aiunit=this;",0.6,"Private"];
diag_log format ["AIUNIT: Creating GUE_Soldier_Medic by %1 at %2. Result:%3 | Loadout:%4 / Num:%5",player,_unitpos,_aiunit,_ailoadout,_rndLOut];
_aiunit enableAI "TARGET";
_aiunit enableAI "AUTOTARGET";
_aiunit enableAI "MOVE";
_aiunit enableAI "ANIM";
_aiunit enableAI "FSM";
_aiunit allowDammage true;
_aiunit setCombatMode "RED";
_aiunit setBehaviour "COMBAT";
//clear default weapons / ammo
removeAllWeapons _aiunit;
removeAllItems _aiunit;
//add random selection
_aiwep = _ailoadout select 0; //Main Weapon
_aiammo = _ailoadout select 1; // Main Weap Ammo
_aisidearm = _aiside select 0; //Sidearm
_aisidearmammo = _aiside select 1; //Sideaerm Ammo
_aigear = _aiequipspawn select 0; //Equipment
_aiunit addweapon _aiwep;
_aiunit addMagazine _aiammo;
_aiunit addMagazine _aiammo;
_aiunit addMagazine _aiammo;
_aiunit addMagazine _aiammo;
_aiunit addMagazine _aiammo;
_aiunit addMagazine _aiammo;
_aiunit addMagazine _aiammo;
_aiunit addMagazine _aiammo;
// Add sidearm and mags
_aiunit addweapon _aisidearm;
_aiunit addMagazine _aisidearmammo;
_aiunit addMagazine _aisidearmammo;
_aiunit addMagazine _aisidearmammo;
// add gear
_aiunit addWeapon _aigear;
//_aiunit addMagazine _aigear;
//set skills
_aiunit setSkill ["aimingAccuracy",1];
_aiunit setSkill ["aimingShake",1];
_aiunit setSkill ["aimingSpeed",1];
_aiunit setSkill ["endurance",1];
_aiunit setSkill ["spotDistance",1];
_aiunit setSkill ["spotTime",1];
_aiunit setSkill ["courage",1];
_aiunit setSkill ["reloadSpeed",1];
_aiunit setSkill ["commanding",1];
_aiunit setSkill ["general",1];
sleep 0.5;
} ;