1- params [" _units" , " _type" ];
2-
3- if (count _units == 0 ) then {_units = [player ]};
4-
5- if (_type == 3 ) exitWith {
6- {
7- _x addMagazine " HandGrenade" ;
8- } forEach _units ;
9- };
10- if (_type == 4 ) exitWith {
11- {
12- _x addItem " FirstAidKit" ;
13- _loadOut = getUnitLoadout _x ;
14- (_loadOut select 9 ) params [" _ItemMap" ," _ItemGPS" ," _ItemRadio" ," _ItemCompass" ," _ItemWatch" ," _NVGoggles" ];
15- (_loadOut select 8 ) params [[" _Binocular" , " " ]];
16- if (_ItemMap == " " ) then {_x addItem " ItemMap" ; _x assignItem " ItemMap" };
17- if (_ItemCompass == " " ) then {_x addItem " ItemCompass" ; _x assignItem " ItemCompass" };
18- if (_ItemWatch == " " ) then {_x addItem " ItemWatch" ; _x assignItem " ItemWatch" };
19- if (_ItemRadio == " " ) then {_x addItem " ItemRadio" ; _x assignItem " ItemRadio" };
20- if (_ItemGPS == " " ) then {
21- _side = [" O" , " B" , " I" , " C" ] select ((side group player ) call BIS_fnc_sideID );
22- _ItemGPS = format [" %1_UAVTerminal" , _side ];
23- _x addItem _ItemGPS ;
24- _x assignItem _ItemGPS
25- };
26- if (_NVGoggles == " " ) then {_x addItem " NVGoggles" ; _x assignItem " NVGoggles" };
27- if (_Binocular == " " ) then {_x addWeapon " RangeFinder" };
28- } forEach _units ;
29- };
30-
31- _wpnType = " " ;
32- _magType = " " ;
33- _cnt = 1 ;
34- call {
35- if (_type == 0 ) exitWith {
36- _wpnType = " primaryWeapon" ;
37- _magType = " primaryWeaponMagazine" ;
38- _cnt = 2 ;
39- };
40-
41- if (_type == 1 ) exitWith {
42- _wpnType = " handgunWeapon" ;
43- _magType = " handgunMagazine" ;
44- };
45-
46- if (_type == 2 ) exitWith {
47- _wpnType = " secondaryWeapon" ;
48- _magType = " secondaryWeaponMagazine" ;
49- };
50- };
51-
52- _cfgWeapons = configFile >> " cfgWeapons" ;
53- _cfgMags = configFile >> " cfgMagazines" ;
54- {
55- _unit = _x ;
56- _weapon = call compile format [" %1 _unit" , _wpnType ];
57- if (_weapon ! = " " ) then {
58- _muzzles = (getArray (_cfgWeapons >> _weapon >> " muzzles" )) select {_x ! = " this" };
59- _preferedMag = call compile format [" %1 _unit" , _magType ];
60- _compatibleMags = getArray (_cfgWeapons >> _weapon >> " magazines" );
61- _mag = if ! (_preferedMag isEqualTo []) then {
62- _preferedMag = _preferedMag select {_x in _compatibleMags };
63- if (count _preferedMag ! = 0 ) then {
64- _preferedMag = _preferedMag select 0 ;
65- _ammoCnt = getNumber (_cfgMags >> _preferedMag >> " Count" );
66- _unit setAmmo [_weapon , _ammoCnt ];
67- _preferedMag
68- } else {
69- selectRandom _compatibleMags
70- }
71- } else {
72- selectRandom _compatibleMags
73- };
74- _unit addMagazines [_mag , _cnt ];
75- {
76- _mags = getArray (_cfgWeapons >> _weapon >> _x >> " magazines" );
77- if (count _mags ! = 0 ) then {
78- _ideal = _mags select {([" HE" , _x , true ] call BIS_fnc_inString ) || {([" AP" , _x , true ] call BIS_fnc_inString )}};
79- _mag = if ! (_ideal isEqualTo []) then {selectRandom _ideal } else {selectRandom _mags };
80- _unit addMagazines [_mag , _cnt ];
81- };
82- } forEach _muzzles ;
83- };
1+ params [" _units" , " _type" ];
2+
3+ if (count _units == 0 ) then {_units = [player ]};
4+
5+ if (_type == 3 ) exitWith {
6+ {
7+ _x addMagazine " HandGrenade" ;
8+ } forEach _units ;
9+ };
10+ if (_type == 4 ) exitWith {
11+ {
12+ _x addItem " FirstAidKit" ;
13+ _loadOut = getUnitLoadout _x ;
14+ (_loadOut select 9 ) params [" _ItemMap" ," _ItemGPS" ," _ItemRadio" ," _ItemCompass" ," _ItemWatch" ," _NVGoggles" ];
15+ (_loadOut select 8 ) params [[" _Binocular" , " " ]];
16+ if (_ItemMap == " " ) then {_x addItem " ItemMap" ; _x assignItem " ItemMap" };
17+ if (_ItemCompass == " " ) then {_x addItem " ItemCompass" ; _x assignItem " ItemCompass" };
18+ if (_ItemWatch == " " ) then {_x addItem " ItemWatch" ; _x assignItem " ItemWatch" };
19+ if (_ItemRadio == " " ) then {_x addItem " ItemRadio" ; _x assignItem " ItemRadio" };
20+ if (_ItemGPS == " " ) then {
21+ _side = [" O" , " B" , " I" , " C" ] select ((side group player ) call BIS_fnc_sideID );
22+ _ItemGPS = format [" %1_UAVTerminal" , _side ];
23+ _x addItem _ItemGPS ;
24+ _x assignItem _ItemGPS
25+ };
26+ if (_NVGoggles == " " ) then {_x addItem " NVGoggles" ; _x assignItem " NVGoggles" };
27+ if (_Binocular == " " ) then {_x addWeapon " RangeFinder" };
28+ } forEach _units ;
29+ };
30+
31+ _wpnType = " " ;
32+ _magType = " " ;
33+ _cnt = 1 ;
34+ call {
35+ if (_type == 0 ) exitWith {
36+ _wpnType = " primaryWeapon" ;
37+ _magType = " primaryWeaponMagazine" ;
38+ _cnt = 2 ;
39+ };
40+
41+ if (_type == 1 ) exitWith {
42+ _wpnType = " handgunWeapon" ;
43+ _magType = " handgunMagazine" ;
44+ };
45+
46+ if (_type == 2 ) exitWith {
47+ _wpnType = " secondaryWeapon" ;
48+ _magType = " secondaryWeaponMagazine" ;
49+ };
50+ };
51+
52+ _cfgWeapons = configFile >> " cfgWeapons" ;
53+ _cfgMags = configFile >> " cfgMagazines" ;
54+ {
55+ _unit = _x ;
56+ _weapon = call compile format [" %1 _unit" , _wpnType ];
57+ if (_weapon ! = " " ) then {
58+ _muzzles = (getArray (_cfgWeapons >> _weapon >> " muzzles" )) select {_x ! = " this" };
59+ _preferedMag = call compile format [" %1 _unit" , _magType ];
60+ _compatibleMags = getArray (_cfgWeapons >> _weapon >> " magazines" );
61+ _mag = if ! (_preferedMag isEqualTo []) then {
62+ _preferedMag = _preferedMag select {_x in _compatibleMags };
63+ if (count _preferedMag ! = 0 ) then {
64+ _preferedMag = _preferedMag select 0 ;
65+ _ammoCnt = getNumber (_cfgMags >> _preferedMag >> " Count" );
66+ _unit setAmmo [_weapon , _ammoCnt ];
67+ _preferedMag
68+ } else {
69+ selectRandom _compatibleMags
70+ }
71+ } else {
72+ selectRandom _compatibleMags
73+ };
74+ _unit addMagazines [_mag , _cnt ];
75+ {
76+ _mags = getArray (_cfgWeapons >> _weapon >> _x >> " magazines" );
77+ if (count _mags ! = 0 ) then {
78+ _ideal = _mags select {([" HE" , _x , true ] call BIS_fnc_inString ) || {([" AP" , _x , true ] call BIS_fnc_inString )}};
79+ _mag = if ! (_ideal isEqualTo []) then {selectRandom _ideal } else {selectRandom _mags };
80+ _unit addMagazines [_mag , _cnt ];
81+ };
82+ } forEach _muzzles ;
83+ };
8484} forEach _units ;
0 commit comments