@@ -4,6 +4,20 @@ _index = lbCurSel 2102;
44_spawnPos = getpos player ;
55_spawnPos = [(_spawnPos select 0 )+ 30 , _spawnPos select 1 ];
66
7+ _addEWS_EH = {
8+ (_this select 0 ) addEventHandler [" IncomingMissile" , {
9+ _target = _this select 0 ;
10+ _attacker = _this select 3 ;
11+
12+ if (player in crew (_target )) then {
13+ _target say3D [" alarmCar" , 1 ,1 ];
14+ _azi = (_target ) getDir (_attacker );
15+
16+ titleText [format [" Incoming Missile: Bearing %1" , str floor _azi ], " PLAIN" , 0.4 ];
17+ };
18+ }];
19+ };
20+
721switch (_index ) do {
822 case 0 : { // Small Truck 1
923 if (commandpointsblu1 >= 4 ) then {
@@ -81,12 +95,7 @@ switch (_index) do {
8195 commandpointsblu1 = commandpointsblu1 - 35 ;
8296 ctrlSetText [1000 , format [" %1" ,commandpointsblu1]];
8397 _vehic = " B_APC_Wheeled_01_cannon_F" createVehicle _spawnPos ;
84- _vehic addEventHandler [" IncomingMissile" , {
85- playSound " alarmCar" ;
86- _azi = player getDir (_this select 3 );
87- titleText [format [" Incoming Missile: Bearing %1" , str floor _azi ], " PLAIN" , 0.4 ];
88- }
89- ];
98+ [_vehic ] spawn _addEWS_EH ;
9099 } else {
91100 hint " Not enough command points" ;
92101 };
@@ -179,12 +188,7 @@ switch (_index) do {
179188 commandpointsblu1 = commandpointsblu1 - 25 ;
180189 ctrlSetText [1000 , format [" %1" ,commandpointsblu1]];
181190 _vehic = " B_APC_Tracked_01_rcws_F" createVehicle _spawnPos ;
182- _vehic addEventHandler [" IncomingMissile" , {
183- playSound " alarmCar" ;
184- _azi = player getDir (_this select 3 );
185- titleText [format [" Incoming Missile: Bearing %1" , str floor _azi ], " PLAIN" , 0.4 ];
186- }
187- ];
191+ [_vehic ] spawn _addEWS_EH ;
188192 } else {
189193 hint " Not enough command points" ;
190194 };
@@ -205,12 +209,7 @@ switch (_index) do {
205209 commandpointsblu1 = commandpointsblu1 - 30 ;
206210 ctrlSetText [1000 , format [" %1" ,commandpointsblu1]];
207211 _vehic = " B_APC_Tracked_01_AA_F" createVehicle _spawnPos ;
208- _vehic addEventHandler [" IncomingMissile" , {
209- playSound " alarmCar" ;
210- _azi = player getDir (_this select 3 );
211- titleText [format [" Incoming Missile: Bearing %1" , str floor _azi ], " PLAIN" , 0.4 ];
212- }
213- ];
212+ [_vehic ] spawn _addEWS_EH ;
214213 } else {
215214 hint " Not enough command points" ;
216215 };
@@ -221,12 +220,7 @@ switch (_index) do {
221220 commandpointsblu1 = commandpointsblu1 - 40 ;
222221 ctrlSetText [1000 , format [" %1" ,commandpointsblu1]];
223222 _vehic = " B_MBT_01_cannon_F" createVehicle _spawnPos ;
224- _vehic addEventHandler [" IncomingMissile" , {
225- playSound " alarmCar" ;
226- _azi = player getDir (_this select 3 );
227- titleText [format [" Incoming Missile: Bearing %1" , str floor _azi ], " PLAIN" , 0.4 ];
228- }
229- ];
223+ [_vehic ] spawn _addEWS_EH ;
230224 } else {
231225 hint " Not enough command points" ;
232226 };
@@ -237,12 +231,7 @@ switch (_index) do {
237231 commandpointsblu1 = commandpointsblu1 - 28 ;
238232 ctrlSetText [1000 , format [" %1" ,commandpointsblu1]];
239233 _vehic = " B_APC_Tracked_01_CRV_F" createVehicle _spawnPos ;
240- _vehic addEventHandler [" IncomingMissile" , {
241- playSound " alarmCar" ;
242- _azi = player getDir (_this select 3 );
243- titleText [format [" Incoming Missile: Bearing %1" , str floor _azi ], " PLAIN" , 0.4 ];
244- }
245- ];
234+ [_vehic ] spawn _addEWS_EH ;
246235 } else {
247236 hint " Not enough command points" ;
248237 };
@@ -315,12 +304,7 @@ switch (_index) do {
315304 commandpointsblu1 = commandpointsblu1 - 40 ;
316305 ctrlSetText [1000 , format [" %1" ,commandpointsblu1]];
317306 _vehic = " B_MBT_01_TUSK_F" createVehicle _spawnPos ;
318- _vehic addEventHandler [" IncomingMissile" , {
319- playSound " alarmCar" ;
320- _azi = player getDir (_this select 3 );
321- titleText [format [" Incoming Missile: Bearing %1" , str floor _azi ], " PLAIN" , 0.4 ];
322- }
323- ];
307+ [_vehic ] spawn _addEWS_EH ;
324308 } else {
325309 hint " Not enough command points" ;
326310 };
0 commit comments