Code:
; --------------------------------------------------------------------------------------
; RE-ASSIGN WEAPONS FOR WW4 v4.0
; by kenoxite
;
; Equips individual units or whole groups with predefined sets of weapons. The weapon sets are based on the ones being used by the different types of WW4 units.
; It can also equip high dispersion (HD) ammo, suppressors, night vision goggles, antimaterial rifles (for the snipers) and grenade vests or flare pouches (for the grenadiers).
;
; This script only allows one single instance to be running at any given time. You can still make as many simultaneous calls to this script as you want, but they will be executed
; consecutively to reduce the performance impact. It will take less than a second for a single instance of this script to finish for full groups (12 units). If you want to know
; when all the instances of this script are done you can check if the k_rawww4 variable is undefined.
; Example: if (format ["%1", k_rawww4] == "scalar bool array string 0xfcffffef") then { _scriptsFinished = true }
;
; SETTINGS:
;
; _units (array) - array of units to reassign weapons to
;
; _weapon (string) - weapon type to be used as guide
; Possible values:
; "m4"
; "m16"
; "scar"
; "MP5"
; "LR300"
; "famas"
; "SG552"
; "AUG3"
; "ak74m"
; "Groza"
; "AKS74"
; "AKSU"
; "AKAB"
; "ak47"
; "fal"
;
; _sightInd (integer) - type of sight to be used
; 0 - None
; 1 - Aimpoint or PK01A
; 2 - Reflex or Kobra
; 3 - Holografic
;
; _sd (string) - wheter use suppressor weapon type and ammo or not
; "" - not use suppressor
; "sd" - use suppressor
;
; _hd (string) - wether assign HD ammo or not
; "" - not use high dispersion ammo
; "hd" - use high dispersion ammo
;
; _nv (boolean) - wether assign night vision goggles or not
;
; _antimaterial (boolean) - wether assign antimaterial rifles to snipers or not
;
; _grvest (string) - wheter assign a grenade vest or flare pouch to the grenadiers
; "" - assign standard grenadier equipment
; "vest" - equip grenadiers with grenade vest (which holds 15 rounds instead the usual 5)
; "flares" - equip grenadiers with flare pouches (which hold 5 white flares each), a couple colored flares and a couple explosive grenades
;
; USE:
; [[array of units],"weapon type","sight type","suppressor","high dispersion",nv goggles?,_antimaterial?,"grenadier ammo"] exec "reassignweaponsww4.sqs"
;
; EXAMPLE:
; [units group this,"LR300",0,"","",false,false,"vest"] exec "reassignweaponsww4.sqs"
; (equips all the units in the group with LR300s -and equivalent weapons in that pack- and assign grenade vests to grenadiers)
; --------------------------------------------------------------------------------------
_units = _this select 0;
_weapon = if (count _this > 1) then { _this select 1 } else { "m16" };
_sightInd = if (count _this > 2) then { _this select 2 } else { 0 };
_sd = if (count _this > 3) then { _this select 3 } else { "" };
_hd = if (count _this > 4) then { _this select 4 } else { "" };
_nv = if (count _this > 5) then { _this select 5 } else { false };
_antimaterial = if (count _this > 6) then { _this select 6 } else { false };
_grvest = if (count _this > 7) then { _this select 7 } else { "" };
_debug = false
; ***************
; QUEUE CHECK
; ***************
; Checks if another instance of this script is being executed already
; If so, it'll wait until it finishes
?(count k_rawww4 > 0): goto "initQueue"
_queue = 1
k_rawww4 = [_queue]
?(_debug):player sidechat format ["starting script %1",_queue]
goto "init"
#initQueue
_queue = (k_rawww4 select (count k_rawww4 - 1)) + 1
?(_debug):player sidechat format ["script %1 in queue",_queue]
k_rawww4 set [count k_rawww4,_queue]
goto "queueCheck"
#queueCheck
?(k_rawww4 select 0 == _queue): if (_debug) then { player sidechat format ["starting script %1",_queue] }, goto "init"
~0.1
goto "queueCheck"
#init
; ***************
; INIT
; ***************
_uType = "";
_ammo = "";
_genericClass = "";
_side = "";
_special = false;
_burst = "";
_sight = "";
_priWpn = "";
_secWpn = "";
_priAmmo = "";
_secAmmo = "";
_spAmmo = "";
_pistol = "";
_sightsWest = ["","aim","ref","holo"];
_sightsEast = ["","PK01A","kobra"];
_offSight = "";
_topSight = 1;
_sightsSide = [];
_prefixes = ["WW4_WAR","WW4_DWAR","WW4_MAR","WW4_DMAR","WW4_MOT","WW4_DMOT","WW4_NAV","WW4_DNAV","WW4_REVE","WW4_DREVE","WW4_INS","WW4_DINS","WW4_GUER","WW4_DGUER","WW4_MIL","WW4_DMIL","WW4_RMER","WW4_DRMER","WW4_EVCT","WW4_DEVCT","WW4_EVSF","WW4_DEVSF","WW4_EVPAR","WW4_DEVPAR","WW4_EVREC","WW4_DEVREC","WW4_DGR","WW4_DDGR","WW4_DEL","WW4_DDEL","WW4_PARW","WW4_DPARW","WW4_SHW","WW4_DSHW","WW4_FOREC","WW4_DFOREC","WW4_VTZ","WW4_DVTZ","WW4_VDV","WW4_DVDV","WW4_OMN","WW4_DOMN","WW4_SHE","WW4_DSHE","WW4_SPER","WW4_DSPER"];
_wait = 0.05;
_c = 0;
_uC = 0;
; ***************
; WEAPONS
; ***************
; special kits
; some weapons (like sniper rifles) will be assigned for this special cases, independently of their _side
if (_weapon == "m4" or _weapon == "scar" or _weapon == "MP5" or _weapon == "LR300" or _weapon == "famas" or _weapon == "AUG3" or _weapon == "ak47") then { _special = true; };
; western weapons
if (_weapon == "MP5") then { _topSight = 1; };
if (_weapon == "famas" or _weapon == "LR300") then { if (_sd == "") then { _topSight = 1; } else { _topSight = 0; } };
if (_weapon == "m16") then { _burst = "B"; if (_sd == "") then { _topSight = 2; } else { _topSight = 0; } };
if (_weapon == "scar") then { if (_sd == "") then { _topSight = 2; } else { _topSight = 0; } };
if (_weapon == "m4") then { _topSight = 3; };
if (_weapon == "SG552") then { _topSight = 3; if (_sd == "") then { _topSight = 3; } else { _topSight = 2; } };
if (_weapon == "AUG3") then { _topSight = 2; };
if (_weapon == "m4" or _weapon == "m16" or _weapon == "scar" or _weapon == "famas" or _weapon == "AUG3" or _weapon == "SG552" or _weapon == "LR300") then { _ammo = "W556_30"; _side = "west"; };
if (_weapon == "MP5") then { _ammo = "MP5SA"; _side = "west";};
; eastern weapons
if (_weapon == "AKS74") then { if (_sd == "") then { _topSight = 1; } else { _topSight = 0; } };
if (_weapon == "ak74m" or _weapon == "AKSU") then { _topSight = 2; };
if (_weapon == "Groza") then { if (_sd == "") then { _topSight = 2; } else { _topSight = 0; } };
if (_weapon == "ak47") then { if (_sd == "") then { _topSight = 2; } else { _topSight = 0; }};
if (_weapon == "AKAB") then { if (_sd == "") then { _topSight = 2; } else { _topSight = 0; }};
if (_weapon == "ak74m" or _weapon == "AKS74" or _weapon == "AKSU") then { _ammo = "E545_30"; _side = "east"; };
if (_weapon == "ak47") then { _ammo = "E762_30"; _side = "east"; };
if (_weapon == "Groza") then { _ammo = "E9x39_20"; _side = "east"; };
if (_weapon == "AKAB") then { _ammo = "AE545_30"; _side = "east"; };
; resistance/neutral weapons
if (_weapon == "fal") then { if (_sd == "") then { _topSight = 1; } else { _topSight = 0; } };
if (_weapon == "fal") then { _ammo = "W762_20"; _side = "res"; };
; ***************
; SIGHTS
; ***************
if (_side == "west" or _side == "res") then { _sightsSide = _sightsWest; } else { _sightsSide = _sightsEast; };
; default sights
if (_sightInd <= _topSight) then { _sight = _sightsSide select _sightInd; } else { _sight = _sightsSide select _topSight; };
; officer sights
if ((_sightInd + 1) <= _topSight) then { if ((_sightInd + 1) <= (count _sightsSide - 1)) then { _offSight = _sightsSide select (_sightInd + 1); } else { _offSight = _sightsSide select (count _sightsSide - 1); }; } else { _offSight = _sightsSide select _topSight; };
; sight - exceptions
if (_weapon == "SG552") then { if (_sight == "aim") then { _sight = "ref" }; if (_offSight == "aim") then { _offSight = "ref" }; };
if (_weapon == "AUG3") then { if (_sightInd <= 1 or _sd == "sd") then { _sight = "aim" } else { _sight = "M145" }; if (_sd == "") then { _offSight = "M145" } else { _offSight = "aim" } };
if (_weapon == "Groza") then { if (_sight == "PK01A") then { _sight = "kobra" }; if (_offSight == "PK01A") then { _offSight = "kobra" }; };
if (_weapon == "ak74m") then { if (_sd == "sd" and (_sight == "PK01A" or _offSight == "PK01A")) then { _sight = "kobra"; _offSight = "kobra" } };
; undefine variables
_sightsSide = nil;
_sightInd = nil;
_topSight = nil;
_sightsWest = nil;
_sightsEast = nil;
; ***************
; ASSIGNMENT LOOP
; ***************
#next
if (_uC == count _units) then { goto "end" };
_currUnit = _units select _uC
_uC = _uC + 1
removeAllWeapons _currUnit;
; --------------------------------
; GET GLOBAL CLASS OF CURRENT UNIT
; --------------------------------
_uType = typeOf _currUnit;
_genericClass = "";
_priWpn = "";
_secWpn = "";
_priAmmo = "";
_secAmmo = "";
_spAmmo = "";
_pistol = "";
; check if rifleman
if (_genericClass == "") then { if (_uType == "SoldierWB" or _uType == "SoldierW" or _uType == "SoldierWNOG" or _uType == "SoldierEFakeW" or _uType == "SoldierEB" or _uType == "SoldierE" or _uType == "SoldierENOG" or _uType == "SoldierWFakeE" or _uType == "SoldierGB" or _uType == "SoldierGNOG") then { _genericClass = "rifleman" }; };
if (_genericClass == "") then {{ if (_uType == format ["%1Rifleman",_x] or _uType == format ["%1RiflemanW",_x] or _uType == format ["%1RiflemanE",_x]) then { _genericClass = "rifleman" }; } forEach _prefixes; };
; check if grenadier
if (_genericClass == "") then { if (_uType == "SoldierWG" or _uType == "SoldierEG" or _uType == "SoldierGG") then { _genericClass = "grenadier" }; };
if (_genericClass == "") then {{ if (_uType == format ["%1Grenadier",_x] or _uType == format ["%1GrenadierW",_x] or _uType == format ["%1GrenadierE",_x]) then { _genericClass = "grenadier" }; } forEach _prefixes; };
; check if medic
if (_genericClass == "") then { if (_uType == "SoldierWMedic" or _uType == "SoldierEMedic" or _uType == "SoldierGMedic") then { _genericClass = "medic" }; };
if (_genericClass == "") then {{ if (_uType == format ["%1Medic",_x] or _uType == format ["%1MedicW",_x] or _uType == format ["%1MedicE",_x]) then { _genericClass = "medic" }; } forEach _prefixes; };
; check if autorifleman
if (_genericClass == "") then {{ if (_uType == format ["%1Autorifleman",_x] or _uType == format ["%1AutoriflemanW",_x] or _uType == format ["%1AutoriflemanE",_x]) then { _genericClass = "autorifleman" }; } forEach _prefixes; };
; check if machinegun
if (_genericClass == "") then { if (_uType == "SoldierWMG" or _uType == "SoldierEMG" or _uType == "SoldierGMG") then { _genericClass = "machinegun" }; };
if (_genericClass == "") then {{ if (_uType == format ["%1Machinegun",_x] or _uType == format ["%1MachinegunW",_x] or _uType == format ["%1MachinegunE",_x]) then { _genericClass = "machinegun" }; } forEach _prefixes; };
; check if rocket
if (_genericClass == "") then { if (_uType == "SoldierWLAW" or _uType == "SoldierELAW" or _uType == "SoldierGLAW") then { _genericClass = "rocket" }; };
if (_genericClass == "") then {{ if (_uType == format ["%1Rocket",_x] or _uType == format ["%1RocketW",_x] or _uType == format ["%1RocketE",_x]) then { _genericClass = "rocket" }; } forEach _prefixes; };
; check if at
if (_genericClass == "") then { if (_uType == "SoldierWAT" or _uType == "SoldierEAT" or _uType == "SoldierGAT") then { _genericClass = "at" }; };
if (_genericClass == "") then {{ if (_uType == format ["%1AT",_x] or _uType == format ["%1ATW",_x] or _uType == format ["%1ATE",_x]) then { _genericClass = "at" }; } forEach _prefixes; };
; check if ath
if (_genericClass == "") then {{ if (_uType == format ["%1ATH",_x] or _uType == format ["%1ATHW",_x] or _uType == format ["%1ATHE",_x]) then { _genericClass = "ath" }; } forEach _prefixes; };
; check if aa
if (_genericClass == "") then { if (_uType == "SoldierWAA" or _uType == "SoldierEAA" or _uType == "SoldierGAA") then { _genericClass = "aa" }; };
if (_genericClass == "") then {{ if (_uType == format ["%1AA",_x] or _uType == format ["%1AAW",_x] or _uType == format ["%1AAE",_x]) then { _genericClass = "aa" }; } forEach _prefixes; };
; check if marksman
if (_genericClass == "") then {{ if (_uType == format ["%1Marksman",_x] or _uType == format ["%1MarksmanW",_x] or _uType == format ["%1MarksmanE",_x]) then { _genericClass = "marksman" }; } forEach _prefixes; };
; check if sniper
if (_genericClass == "") then { if (_uType == "SoldierWSniper" or _uType == "SoldierESniper") then { _genericClass = "sniper" }; };
if (_genericClass == "") then {{ if (_uType == format ["%1Sniper",_x] or _uType == format ["%1SniperW",_x] or _uType == format ["%1SniperE",_x]) then { _genericClass = "sniper" }; } forEach _prefixes; };
; check if demolition
if (_genericClass == "") then { if (_uType == "SoldierWSaboteurPipe" or _uType == "SoldierWSaboteurDay" or _uType == "SoldierWSaboteurPipeHG" or _uType == "SoldierWSaboteurXMS" or _uType == "SoldierWSaboteurPipeHGS" or _uType == "SoldierWSaboteurLaser" or _uType == "SoldierESaboteurPipe" or _uType == "SoldierESaboteurBizon" or _uType == "SoldierESaboteurPipeHG") then { _genericClass = "demolition" }; };
if (_genericClass == "") then {{ if (_uType == format ["%1Demolition",_x] or _uType == format ["%1DemolitionW",_x] or _uType == format ["%1DemolitionE",_x]) then { _genericClass = "demolition" }; } forEach _prefixes; };
; check if engineer
if (_genericClass == "") then { if (_uType == "SoldierWMiner" or _uType == "SoldierEMiner") then { _genericClass = "engineer" }; };
if (_genericClass == "") then {{ if (_uType == format ["%1Engineer",_x] or _uType == format ["%1EngineerW",_x] or _uType == format ["%1EngineerE",_x]) then { _genericClass = "engineer" }; } forEach _prefixes; };
; check if leader
if (_genericClass == "") then {{ if (_uType == format ["%1SquadLeader",_x] or _uType == format ["%1SquadLeaderW",_x] or _uType == format ["%1SquadLeaderE",_x]) then { _genericClass = "leader" }; } forEach _prefixes; };
; check if officer
if (_genericClass == "") then { if (_uType == "OfficerW" or _uType == "OfficerWNight" or _uType == "OfficerWHG" or _uType == "OfficerE" or _uType == "OfficerENight" or _uType == "OfficerEHG" or _uType == "OfficerG" or _uType == "OfficerGNight" or _uType == "OfficerGHG") then { _genericClass = "officer" }; };
if (_genericClass == "") then {{ if (_uType == format ["%1Officer",_x] or _uType == format ["%1OfficerW",_x] or _uType == format ["%1OfficerE",_x]) then { _genericClass = "officer" }; } forEach _prefixes; };
; check if crew
if (_genericClass == "") then { if (_uType == "SoldierWCrew" or _uType == "SoldierECrew" or _uType == "SoldierGCrew") then { _genericClass = "crew" }; };
if (_genericClass == "") then {{ if (_uType == format ["%1Crew",_x]) then { _genericClass = "crew" }; } forEach _prefixes; };
; check if pilot
if (_genericClass == "") then { if (_uType == "SoldierWPilot" or _uType == "SoldierWPilotHG" or _uType == "SoldierEPilot" or _uType == "SoldierGPilot") then { _genericClass = "pilot" }; };
if (_genericClass == "") then {{ if (_uType == format ["%1Pilot",_x]) then { _genericClass = "pilot" }; } forEach _prefixes; };
if (_genericClass != "") then { goto _genericClass };
; ERROR
if (_debug) then { player sidechat format ["ERROR (script %2): Couldn't get class of ""%1""",_currUnit,_queue]; goto "end" };
; --------------------------------
#rifleman
_c = 0; while {_c < 6} do { _currUnit addMagazine format ["WW4_%1%2%3%4mag",_ammo,_burst,_sd,_hd]; _c = _c + 1; };
_c = 0; while {_c < 4} do { _currUnit addMagazine "handgrenade"; _c = _c + 1; };
if (_weapon == "MP5") then { _priWpn = format ["WW4_%1%2%3",_weapon,_sd,_sight]; } else { _priWpn = format ["WW4_%1%2%3",_weapon,_sight,_sd]; };
goto "equip"
#grenadier
if (_weapon == "m4") then { _priAmmo = format ["WW4_%1%2%3%4mag",_ammo,_burst,_sd,_hd]; } else { _priAmmo = format ["WW4_%1%2%3mag",_ammo,_burst,_hd]; };
_c = 0; while {_c < 4} do { _currUnit addMagazine _priAmmo; _c = _c + 1; };
if (_side == "east") then { goto "grenadierEast" };
#grenadierWest
if (_grvest != "") then { goto "grenadierWVest" };
_c = 0; while {_c < 6} do { _currUnit addMagazine "WW4_M433grenade"; _c = _c + 1; };
goto "grenadierCont"
#grenadierWVest
if (_grvest != "vest") then { goto "grenadierWFlare" };
_currUnit addMagazine "WW4_M433Vest";
_currUnit addMagazine "smokeshell";
goto "grenadierCont"
#grenadierWFlare
_currUnit addMagazine "WW4_M433grenade";
_currUnit addMagazine "WW4_M433grenade";
_currUnit addMagazine "FlareGreen";
_currUnit addMagazine "FlareRed";
_currUnit addMagazine "WW4_FlarePouch";
goto "grenadierCont"
#grenadierEast
if (_grvest != "") then { goto "grenadierEVest" };
_c = 0; while {_c < 6} do { _currUnit addMagazine "WW4_VOG25grenade"; _c = _c + 1; };
goto "grenadierCont"
#grenadierEVest
if (_grvest != "vest") then { goto "grenadierEFlare" };
_currUnit addMagazine "WW4_VOG25Vest";
_currUnit addMagazine "smokeshell";
goto "grenadierCont"
#grenadierEFlare
_currUnit addMagazine "WW4_VOG25grenade";
_currUnit addMagazine "WW4_VOG25grenade";
_currUnit addMagazine "FlareGreen";
_currUnit addMagazine "FlareRed";
_currUnit addMagazine "WW4_FlarePouch";
goto "grenadierCont"
#grenadierCont
if (_weapon == "m4") then { if (_sd == "") then { if (_sight == "") then { _priWpn = "WW4_M4M203"; } else { _priWpn = "WW4_M4AimM203"; };} else { _priWpn = "WW4_M4M203SD"; }; };
if (_weapon == "m16") then { _priWpn = "WW4_M16M203" };
if (_weapon == "ak74m") then { if (_sight == "kobra") then { _priWpn = "ww4_AK74MKobraGP25"; } else { _priWpn = "WW4_AK74MGP25"; }; };
if (_weapon == "AKS74") then { _priWpn = "WW4_AKS74GP25" };
if (_weapon == "AKSU") then { if (_sd == "") then { _priWpn = "WW4_AKSUGP25"; } else { _priWpn = "WW4_AKSUGP25SD"; }; };
if (_weapon == "scar") then { _priWpn = "WW4_SCARM203"; };
if (_weapon == "fal") then { _priWpn = "WW4_FALM203"; };
if (_weapon == "ak47") then { _priWpn = "WW4_AK47GP25"; };
if (_weapon == "famas") then { _priWpn = "WW4_FAMASM203"; };
if (_weapon == "SG552") then { if (_sight == "") then { _priWpn = "WW4_SG552M203"; } else { _priWpn = "WW4_SG552AimM203"; }; };
if (_weapon == "AUG3") then { _priWpn = "WW4_AUG3AimM203"; };
if (_weapon == "MP5") then { _priWpn = "WW4_MP5M203"; };
if (_weapon == "LR300") then { _priWpn = "WW4_LR300M203"; };
if (_weapon == "Groza") then { _priWpn = "WW4_GrozaGP25"; };
if (_weapon == "AKAB") then { _priWpn = "WW4_AKABGP25"; };
goto "equip"
#medic
_c = 0; while {_c < 4} do { _currUnit addMagazine format ["WW4_%1%2%3%4mag",_ammo,_burst,_sd,_hd]; _c = _c + 1; };
if (_weapon == "MP5") then { _priWpn = format ["WW4_%1%2%3",_weapon,_sd,_sight]; } else { _priWpn = format ["WW4_%1%2%3",_weapon,_sight,_sd]; };
goto "equip"
#autorifleman
if (_side == "west" or _side == "res") then { _spAmmo = format ["WW4_W556M_200%1%2mag",_sd,_hd]; };
if (_side == "east") then { if (_special) then { _spAmmo = format ["WW4_E762M_40%1mag",_hd]; } else { if (_sd == "") then { _spAmmo = format ["WW4_E545M_75%1mag",_hd]; } else { _spAmmo = format ["WW4_E545M_75SD%1mag",_hd]; }; }; };
_c = 0; while {_c < 5} do { _currUnit addMagazine _spAmmo; _c = _c + 1; };
if (_side == "west" or _side == "res") then { if (_sd == "") then { if (_sight == "") then { _priWpn = "WW4_M249"; } else { _priWpn = "WW4_M249Aim"; }; } else { _priWpn = "WW4_M249SD"; }; };
if (_side == "east") then { if (_special) then { _priWpn = "WW4_RPK47"; } else { if (_sd == "") then { if (_sight == "kobra") then { _priWpn = "ww4_RPK74Kobra"; } else { _priWpn = "WW4_RPK74"; }; } else { _priWpn = "WW4_RPK74SD"; }; }; };
goto "equip"
#machinegun
if (_side == "west" or _side == "res") then { _spAmmo = format ["WW4_W762M_200%1mag",_hd]; };
if (_side == "east") then { _spAmmo = format ["WW4_E762M_200%1mag",_hd]; };
_c = 0; while {_c < 5} do { _currUnit addMagazine _spAmmo; _c = _c + 1; };
if ((_side == "west" or _side == "res") and !_special) then { _priWpn = "WW4_M60"; };
if ((_side == "west" or _side == "res") and _special) then { _priWpn = "WW4_M240"; };
if (_side == "east") then { _priWpn = "WW4_PKM"; };
goto "equip"
#rocket
_c = 0; while {_c < 4} do { _currUnit addMagazine format ["WW4_%1%2%3%4mag",_ammo,_burst,_sd,_hd]; _c = _c + 1; };
if (_side == "west" or _side == "res") then { _c = 0; while {_c < 3} do { _currUnit addMagazine "WW4_SMAWMag"; _c = _c + 1; }; _secWpn = "WW4_SMAWLauncher"; };
if (_side == "east") then { _c = 0; while {_c < 3} do { _currUnit addMagazine "WW4_RPGLauncher"; _c = _c + 1; }; _secWpn = "WW4_RPGLauncher"; };
if (_weapon == "MP5") then { _priWpn = format ["WW4_%1%2%3",_weapon,_sd,_sight]; } else { _priWpn = format ["WW4_%1%2%3",_weapon,_sight,_sd]; };
goto "equip"
#at
_c = 0; while {_c < 4} do { _currUnit addMagazine format ["WW4_%1%2%3%4mag",_ammo,_burst,_sd,_hd]; _c = _c + 1; };
if (_side == "west" or _side == "res") then { _currUnit addMagazine "WW4_CarlGustavLauncher"; _secWpn = "WW4_CarlGustavLauncher"; };
if (_side == "east") then { _currUnit addMagazine "WW4_AT4Launcher"; _secWpn = "WW4_AT4Launcher"; };
if (_weapon == "MP5") then { _priWpn = format ["WW4_%1%2%3",_weapon,_sd,_sight]; } else { _priWpn = format ["WW4_%1%2%3",_weapon,_sight,_sd]; };
goto "equip"
#ath
_c = 0; while {_c < 4} do { _currUnit addMagazine format ["WW4_%1%2%3%4mag",_ammo,_burst,_sd,_hd]; _c = _c + 1; };
if (_side == "west" or _side == "res") then { _currUnit addMagazine "WW4_JavelinMag"; _secWpn = "WW4_JavelinLauncher"; };
if (_side == "east") then { _currUnit addMagazine "WW4_VympelMag"; _secWpn = "WW4_VympelLauncher"; };
if (_weapon == "MP5") then { _priWpn = format ["WW4_%1%2%3",_weapon,_sd,_sight]; } else { _priWpn = format ["WW4_%1%2%3",_weapon,_sight,_sd]; };
goto "equip"
#aa
_c = 0; while {_c < 4} do { _currUnit addMagazine format ["WW4_%1%2%3%4mag",_ammo,_burst,_sd,_hd]; _c = _c + 1; };
if (_side == "west" or _side == "res") then { _currUnit addMagazine "AALauncher"; _secWpn = "AALauncher"; };
if (_side == "east") then { _currUnit addMagazine "9K32Launcher"; _secWpn = "9K32Launcher"; };
if (_weapon == "MP5") then { _priWpn = format ["WW4_%1%2%3",_weapon,_sd,_sight]; } else { _priWpn = format ["WW4_%1%2%3",_weapon,_sight,_sd]; };
goto "equip"
#marksman
if (_side == "west" or _side == "res") then { _spAmmo = format ["WW4_WLR30%1mag",_hd]; };
if (_side == "east") then { _spAmmo = format ["WW4_ELR_30%1mag",_hd]; };
if (_weapon == "m4" or _weapon == "MP5") then { _spAmmo = format ["WW4_WLR30%1%2mag",_sd,_hd]; };
if (_weapon == "AKSU") then { _spAmmo = format ["WW4_ELR_30%1%2mag",_sd,_hd]; };
_c = 0; while {_c < 6} do { _currUnit addMagazine _spAmmo; _c = _c + 1; };
if (_weapon == "m4" or _weapon == "MP5") then { _priWpn = format ["WW4_M4Acog%1",_sd]; };
if (_weapon == "AKSU") then { _priWpn = format ["WW4_AKSUPSO%1",_sd]; };
if (_weapon == "fal") then { _priWpn = "WW4_FALScout"; };
if (!(_weapon == "m4" or _weapon == "MP5" or _weapon == "AKSU" or _weapon == "fal")) then { if (_side == "west" or _side == "res") then { _priWpn = format ["WW4_%1Acog",_weapon]; } else { _priWpn = format ["WW4_%1PSO",_weapon]; }; };
goto "equip"
#sniper
if (_side == "east") then { goto "sniperEast" };
#sniperWest
if (_antimaterial) then { goto "antimaterialW" };
if (_sd != "") then { goto "sniperSilW" };
_spAmmo = format ["WW4_W762Sniper_5%1mag",_hd];
_priWpn = "WW4_M24";
if (_special) then { _spAmmo = format ["WW4_W762Sniper_20%1mag",_hd]; _priWpn = "WW4_M40" };
goto "sniperCont"
#antimaterialW
_spAmmo = format ["WW4_W127_10%1mag",_hd];
_priWpn = "WW4_M82";
goto "sniperCont"
#sniperSilW
_spAmmo = format ["WW4_W762Sniper_20SD%1mag",_hd];
_priWpn = "WW4_SR25SD";
goto "sniperCont"
#sniperEast
if (_antimaterial) then { goto "antimaterialE" };
if (_sd != "" and _weapon != "ak47") then { goto "sniperSilE" };
_spAmmo = format ["WW4_E762_10%1mag",_hd];
_priWpn = "WW4_SVD";
goto "sniperCont"
#antimaterialE
_spAmmo = format ["WW4_E127_10%1mag",_hd];
_priWpn = "WW4_V94";
goto "sniperCont"
#sniperSilE
_spAmmo = format ["WW4_E9x39_20SD%1mag",_hd];
_priWpn = "WW4_VSS";
goto "sniperCont"
#sniperCont
_c = 0; while {_c < 8} do { _currUnit addMagazine _spAmmo; _c = _c + 1; };
goto "equip"
#demolition
if (_weapon == "m4" or _weapon == "m16" or _weapon == "scar" or _weapon == "famas" or _weapon == "AUG3" or _weapon == "SG552" or _weapon == "LR300") then { _spAmmo = format ["WW4_W556_30%1SD%2mag",_burst,_hd]; };
if (_weapon == "ak74m" or _weapon == "AKS74" or _weapon == "AKSU") then { _spAmmo = format ["WW4_E545_30SD%1mag",_hd]; };
if (_weapon == "MP5") then { _spAmmo = format ["WW4_MP5SASD%1mag",_hd]; };
if (_weapon == "fal") then { _spAmmo = format ["WW4_W762_20SD%1mag",_hd]; };
if (_weapon == "ak47") then { _spAmmo = format ["WW4_E762_30SD%1mag",_hd]; };
if (_weapon == "Groza") then { _spAmmo = format ["WW4_E9x39_20SD%1mag",_hd]; };
if (_weapon == "AKAB") then { _spAmmo = format ["WW4_AE545_30SD%1mag",_hd]; };
_c = 0; while {_c < 4} do { _currUnit addMagazine _spAmmo; _c = _c + 1; };
_c = 0; while {_c < 3} do { _currUnit addMagazine "PipeBomb"; _c = _c + 1; };
if (_weapon == "m4") then { _priWpn = format ["WW4_M4%1%2",_sight,_sd] };
if (_weapon == "m16") then { if (_sight == "") then { _priWpn = "WW4_M16SD"; } else { _priWpn = "WW4_M16RefSD"; }; };
if (_weapon == "ak74m") then { if (_sight == "kobra") then { _priWpn = "WW4_AK74MKobraSD"; } else { _priWpn = "WW4_AK74MSD"; }; };
if (_weapon == "AKS74") then { _priWpn = "WW4_AKS74SD"; };
if (_weapon == "AKSU") then { _priWpn = format ["WW4_AKSU%1%2",_sight,_sd] };
if (_weapon == "scar") then { _priWpn = "WW4_SCARSD"; };
if (_weapon == "fal") then { _priWpn = "WW4_FALSD"; };
if (_weapon == "ak47") then { _priWpn = "WW4_AK47SD"; };
if (_weapon == "famas") then { _priWpn = "WW4_FAMASSD"; };
if (_weapon == "SG552") then { if (_sight == "ref") then { _priWpn = "WW4_SG552RefSD"; } else { _priWpn = "WW4_SG552SD"; }; };
if (_weapon == "AUG3") then { _priWpn = "WW4_AUG3AimSD"; };
if (_weapon == "MP5") then { if (_sight == "") then { _priWpn = "WW4_MP5SD"; } else { _priWpn = "WW4_MP5SDAim"; }; };
if (_weapon == "LR300") then { _priWpn = "WW4_LR300SD"; };
if (_weapon == "Groza") then { _priWpn = "WW4_GrozaSD"; };
if (_weapon == "AKAB") then { _priWpn = "WW4_AKABSD"; };
_currUnit addWeapon "nvgoggles";
goto "equip"
#engineer
_c = 0; while {_c < 4} do { _currUnit addMagazine format ["WW4_%1%2%3%4mag",_ammo,_burst,_sd,_hd]; _c = _c + 1; };
if (_side == "west" or _side == "res") then { _c = 0; while {_c < 3} do { _currUnit addMagazine "Mine"; _c = _c + 1; }; };
if (_side == "east") then { _c = 0; while {_c < 3} do { _currUnit addMagazine "MineE"; _c = _c + 1; }; };
if (_weapon == "MP5") then { _priWpn = format ["WW4_%1%2%3",_weapon,_sd,_sight]; } else { _priWpn = format ["WW4_%1%2%3",_weapon,_sight,_sd]; };
_currUnit addWeapon "binocular";
goto "equip"
#leader
; same as officer, keep moving
#officer
_c = 0; while {_c < 6} do { _currUnit addMagazine format ["WW4_%1%2%3%4mag",_ammo,_burst,_sd,_hd]; _c = _c + 1; };
_c = 0; while {_c < 2} do { _currUnit addMagazine "handgrenade"; _c = _c + 1; };
_c = 0; while {_c < 2} do { _currUnit addMagazine "SmokeShell"; _c = _c + 1; };
if (_side == "west" or (_side == "res" and _special)) then { _spAmmo = format ["WW4_beretta%1mag",_hd]; _pistol = "WW4_beretta"; };
if (_side == "east") then { _spAmmo = format ["WW4_tokarev%1mag",_hd]; _pistol = "WW4_tokarev"; };
if (_side == "res" and !_special) then { _spAmmo = format ["WW4_glock%1mag",_hd]; _pistol = "WW4_glock"; };
if ((_side == "west" or (_side == "res" and _special)) and _sd != "") then { _spAmmo = "glockSmag"; _pistol = "glockS"; };
_c = 0; while {_c < 4} do { _currUnit addMagazine _spAmmo; _c = _c + 1; };
if (_weapon == "MP5") then { _priWpn = format ["WW4_%1%2%3",_weapon,_sd,_offSight]; } else { _priWpn = format ["WW4_%1%2%3",_weapon,_offSight,_sd]; };
_currUnit addWeapon "binocular";
goto "equip"
#crew
; same as pilot, keep moving
#pilot
_c = 0; while {_c < 4} do { _currUnit addMagazine format ["WW4_%1%2%3%4mag",_ammo,_burst,_sd,_hd]; _c = _c + 1; };
if (_weapon == "MP5") then { _priWpn = format ["WW4_%1%2%3",_weapon,_sd,_sight]; } else { _priWpn = format ["WW4_%1%2%3",_weapon,_sight,_sd]; };
_currUnit addWeapon "nvgoggles";
goto "equip"
; --------------
#equip
; equip weapons
if (_secWpn != "") then { _currUnit addWeapon _secWpn; }
_currUnit addWeapon _priWpn;
if (_pistol != "") then { _currUnit addWeapon _pistol; }
; night vision goggles
if (_nv) then { _currUnit addWeapon "nvgoggles"; };
; --------------
#wait
~_wait
goto "next"
; --------------
#end
k_rawww4 = k_rawww4 - [_queue]
?(_debug):player sidechat format ["script %1 finished",_queue]
?(count k_rawww4 == 0): k_rawww4 = nil
exit