11_unit = _this select 0 ;
22
3+ _type = typeof _unit ;
4+
5+ // Make silencers rare
6+ _items = primaryWeaponItems _unit ;
7+ if ! (_items #0 isEqualTo " " ) then {
8+ if ((random 100 ) < 99 ) then {
9+ _unit removePrimaryWeaponItem (_items #0 );
10+ }
11+ };
12+
13+ // Re-Equip this soldier (75% of the time)
14+ if ((random 100 ) > 25 ) then {
15+ // Primary Weapon
16+ _accessories = _unit weaponAccessories primaryWeapon _unit ;
17+ _base = [primaryWeapon _unit ] call BIS_fnc_baseWeapon ;
18+ _unit removeWeapon (primaryWeapon _unit );
19+ _magazines = getArray (configFile / " CfgWeapons" / _base / " magazines" );
20+ _stock = _unit call OT_fnc_unitStock ;
21+ {
22+ _x params [" _cls" ," _num" ];
23+ if (_cls in _magazines ) then {
24+ private _count = 0 ;
25+ while {_count < _num } do {
26+ _unit removeMagazineGlobal _cls ;
27+ _count = _count + 1 ;
28+ };
29+ };
30+ }foreach (_stock );
31+
32+
33+ _wpn = _base call {
34+ if (_this in OT_allBLUGLRifles) exitWith {selectRandom OT_allBLUGLRifles};
35+ if (_this in OT_allBLUSniperRifles) exitWith {_unit addItemToUniform " ACE_rangeCard" ;selectRandom OT_allBLUSniperRifles};
36+ if (_this in OT_allBLUMachineGuns) exitWith {selectRandom OT_allBLUMachineGuns};
37+ selectRandom OT_allBLURifles;
38+ };
39+
40+ _unit addWeapon _wpn ;
41+ // put accessories back (where possible)
42+ {
43+ _unit addWeaponItem [_wpn , _x ];
44+ }foreach (_accessories );
45+
46+ _magazines = getArray (configFile / " CfgWeapons" / _wpn / " magazines" );
47+
48+ _mag = selectRandom _magazines ;
49+ _unit addWeaponItem [_wpn , _mag ];
50+ _unit addMagazineGlobal _mag ;
51+ _unit addMagazineGlobal _mag ;
52+ _unit addMagazineGlobal _mag ;
53+ _unit addMagazineGlobal _mag ;
54+ _unit addMagazineGlobal _mag ;
55+ _unit addMagazineGlobal _mag ;
56+
57+ _secondmags = [];
58+ {
59+ if ! (_x isEqualTo " this" ) then {
60+ _secondmags = _secondmags + getArray (configFile / " CfgWeapons" / _wpn / _x / " magazines" )
61+ };
62+ }foreach (getArray (configFile / " CfgWeapons" / _wpn / " muzzles" ));
63+ if ((count _secondmags ) > 0 ) then {
64+ _mag = _secondmags select 0 ;
65+ _unit addWeaponItem [_wpn , _mag ];
66+ _unit addMagazineGlobal _mag ;
67+ _unit addMagazineGlobal _mag ;
68+ _unit addMagazineGlobal _mag ;
69+ _unit addMagazineGlobal _mag ;
70+ _unit addMagazineGlobal _mag ;
71+ _unit addMagazineGlobal _mag ;
72+ };
73+
74+ // Secondary Weapon
75+ if ! ((_type find " _AA_" ) > - 1 ) then {
76+ if ! (secondaryWeapon _unit isEqualTo " " ) then {
77+ _base = [secondaryWeapon _unit ] call BIS_fnc_baseWeapon ;
78+ _unit removeWeapon (secondaryWeapon _unit );
79+ _magazines = getArray (configFile / " CfgWeapons" / _base / " magazines" );
80+ {
81+ _x params [" _cls" ," _num" ];
82+ if (_cls in _magazines ) then {
83+ private _count = 0 ;
84+ while {_count < _num } do {
85+ _unit removeMagazineGlobal _cls ;
86+ _count = _count + 1 ;
87+ };
88+ };
89+ }foreach (_stock );
90+ _wpn = selectRandom OT_allBLULaunchers;
91+ _unit addWeapon _wpn ;
92+ _magazines = getArray (configFile / " CfgWeapons" / _wpn / " magazines" );
93+
94+ _mag = selectRandom _magazines ;
95+ if ! (_mag isEqualTo " ACE_PreloadedMissileDummy" ) then {
96+ _unit addWeaponItem [_wpn , _mag ];
97+ _unit addMagazineGlobal _mag ;
98+ _unit addMagazineGlobal _mag ;
99+ }else {
100+ removeBackpack _unit ;
101+ };
102+ };
103+ };
104+
105+ // Pistol
106+ _base = [handgunWeapon _unit ] call BIS_fnc_baseWeapon ;
107+ _unit removeWeapon (handgunWeapon _unit );
108+ _magazines = getArray (configFile / " CfgWeapons" / _base / " magazines" );
109+ {
110+ _x params [" _cls" ," _num" ];
111+ if (_cls in _magazines ) then {
112+ private _count = 0 ;
113+ while {_count < _num } do {
114+ _unit removeMagazineGlobal _cls ;
115+ _count = _count + 1 ;
116+ };
117+ };
118+ }foreach (_stock );
119+
120+ _wpn = selectRandom OT_allBLUPistols;
121+ _unit addWeapon _wpn ;
122+ _magazines = getArray (configFile / " CfgWeapons" / _wpn / " magazines" );
123+
124+ _mag = selectRandom _magazines ;
125+ _unit addWeaponItem [_wpn , _mag ];
126+ _unit addMagazineGlobal _mag ;
127+ _unit addMagazineGlobal _mag ;
128+
129+ _unit selectWeapon (primaryWeapon _unit );
130+
131+ };
132+
3133_unit addEventHandler [" HandleDamage" , {
4134 _me = _this select 0 ;
5135 _src = _this select 3 ;
6136 if (captive _src ) then {
7137 if ((vehicle _src ) ! = _src || (_src call OT_fnc_unitSeenNATO )) then {
8- _src setCaptive false ;
9- };
10- };
11- }];
138+ _src setCaptive false ;
139+ };
140+ };
141+ }];
0 commit comments