forked from igorkis-scrts/A3-Antistasi-Plus
-
Notifications
You must be signed in to change notification settings - Fork 87
Expand file tree
/
Copy pathfn_milBuildings.sqf
More file actions
524 lines (504 loc) · 26.3 KB
/
fn_milBuildings.sqf
File metadata and controls
524 lines (504 loc) · 26.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
#include "..\..\script_component.hpp"
FIX_LINE_NUMBERS()
private ["_positionX","_size","_buildings","_groupX","_typeUnit","_sideX","_building","_typeB","_frontierX","_typeVehX","_veh","_vehiclesX","_soldiers","_pos","_ang","_markerX","_unit","_return"];
_markerX = _this select 0;
_positionX = getMarkerPos _markerX;
_size = _this select 1;
_buildings = nearestObjects [_positionX, A3A_milBuildingWhitelist, _size, true];
_buildings = _buildings inAreaArray _markerX;
if (count _buildings == 0) exitWith {[grpNull,[],[]]};
_sideX = _this select 2;
private _faction = Faction(_sideX);
_frontierX = _this select 3;
_vehiclesX = [];
_soldiers = [];
private _spawnsUsed = [];
private _groupX = createGroup _sideX;
private _typeUnit = [_faction get "unitTierStaticCrew"] call SCRT_fnc_unit_getTiered;
//New system to place helis, does not care about heli types currently
private _helicopterTypes = [];
switch (true) do {
case (_markerX in milbases): {
_helicopterTypes append (_faction get "vehiclesHelisTransport");
_helicopterTypes append (_faction get "vehiclesHelisLight");
_helicopterTypes append (_faction get "vehiclesHelisLightAttack");
};
case (_markerX in airportsX): {
_helicopterTypes append (_faction get "vehiclesHelisTransport");
_helicopterTypes append (_faction get "vehiclesHelisLight");
_helicopterTypes append (_faction get "vehiclesHelisLightAttack");
_helicopterTypes append (_faction get "vehiclesHelisAttack");
};
default {
_helicopterTypes append (_faction get "vehiclesHelisLight");
};
};
private _count = 1 + round (random 3); //Change these numbers as you want, first number is minimum, max is first plus second number
while {_count > 0} do
{
if (_helicopterTypes isEqualTo []) exitWith {}; //no helis to pick from
_typeVehX = selectRandom _helicopterTypes;
private _spawnParameter = [_markerX, "Heli"] call A3A_fnc_findSpawnPosition;
if !(_spawnParameter isEqualType []) exitWith {}; // out of spawn places
_spawnsUsed pushBack _spawnParameter#2;
_veh = createVehicle [_typeVehX, (_spawnParameter select 0), [],0, "CAN_COLLIDE"];
_veh setDir (_spawnParameter select 1);
_vehiclesX pushBack _veh;
_count = _count - 1;
};
//Spawning certain statics on fixed buildingPos of chosen buildings
private _fnc_spawnStatic = {
params ["_type", "_pos", "_dir"];
private _veh = createVehicle [_type, _pos, [], 0, "CAN_COLLIDE"];
if (!isNil "_dir") then { _veh setDir _dir };
private _unit = [_groupX, _typeUnit, _positionX, [], 0, "NONE"] call A3A_fnc_createUnit;
_unit moveInGunner _veh;
[_unit,_markerX] call A3A_fnc_NATOinit;
_soldiers pushBack _unit;
_vehiclesX pushBack _veh;
_veh;
};
private _fnc_spawnStaticUnit = {
params ["_type", "_pos", "_dir"];
private _unit = [_groupX, _type, _pos, [], 0, "NONE"] call A3A_fnc_createUnit;
if (!isNil "_dir") then { _unit setDir _dir };
_unit disableAI "PATH"; //block moving
_unit setUnitPos "UP"; //force standing
[_unit,_markerX] call A3A_fnc_NATOinit;
_unit setPosATL _pos;
_soldiers pushBack _unit;
_unit;
};
for "_i" from 0 to (count _buildings) - 1 do
{
if (spawner getVariable _markerX == 2) exitWith {};
private _building = _buildings select _i;
private _typeB = typeOf _building;
call {
if (damage _building >= 1 or isObjectHidden _building) exitWith {}; // don't put statics on destroyed buildings
//Static MGs
if (_typeB isEqualTo "A3U_StaticHolderSmall") then {
private _type = selectRandom (_faction get "staticMGs");
private _dir = (getDir _building);
private _pos = _building modelToWorld [0,0,0];
[_type, _pos, _dir] call _fnc_spawnStatic;
};
if (_typeB in ["A3U_StaticHolderMediumAT", "A3U_StaticHolderLargeAT"]) then {
private _type = selectRandom (_faction get "staticAT");
private _dir = (getDir _building);
private _pos = _building modelToWorld [0,0,0];
[_type, _pos, _dir] call _fnc_spawnStatic;
};
if (_typeB in ["A3U_StaticHolderMediumAA", "A3U_StaticHolderLargeAA"]) then {
private _type = selectRandom (_faction get "staticAA");
private _dir = (getDir _building);
private _pos = _building modelToWorld [0,0,0];
[_type, _pos, _dir] call _fnc_spawnStatic;
};
if ((_typeB == "Land_Cargo_Patrol_V1_F") or (_typeB == "Land_Cargo_Patrol_V2_F") or (_typeB == "Land_Cargo_Patrol_V3_F") or (_typeB == "Land_Cargo_Patrol_V4_F")) exitWith
{
private _type = selectRandom (_faction get "staticMGs");
private _dir = (getDir _building) - 180;
private _zpos = AGLToASL (_building buildingPos 1);
private _pos = _zpos getPos [1.8, _dir]; // zeroes Z value because BIS /// I would like to move mg to the left a bit, but coudn't find a way to do it
_pos = ASLToATL ([_pos select 0, _pos select 1, _zpos select 2]);
[_type, _pos, _dir] call _fnc_spawnStatic;
};
if ((_typeB == "Land_Hlaska") or (_typeB == "Land_vn_hlaska")) exitWith
{
private _type = selectRandom (_faction get "staticMGs");
private _dir = (getDir _building);
private _zpos = AGLToASL (_building buildingPos 1);
private _pos = _zpos getPos [0.5, _dir];
_pos = ASLToATL ([_pos select 0, _pos select 1, _zpos select 2]);
[_type, _pos, _dir] call _fnc_spawnStatic;
};
if ((_typeB == "Land_fortified_nest_small_EP1") or (_typeB == "Land_BagBunker_Small_F") or (_typeB == "Land_BagBunker_01_small_green_F") or (_typeB == "Land_fortified_nest_small") or (_typeB == "Fort_Nest") or (_typeB == "Land_vn_bagbunker_01_small_green_f") or (_typeB == "Land_vn_bagbunker_small_f") or (_typeB == "Land_vn_o_shelter_05")or (_typeB == "Land_vn_bunker_small_01")) exitWith
{
private _type = selectRandom (_faction get "staticMGs");
private _dir = (getDir _building) - 180;
private _zpos = AGLToASL (_building buildingPos 1);
private _pos = _zpos getPos [-1, _dir];
_pos = ASLToATL ([_pos select 0, _pos select 1, _zpos select 2]);
[_type, _pos, _dir] call _fnc_spawnStatic;
};
if ((_typeB == "Land_vn_o_tower_02")) exitWith
{
private _type = selectRandom (_faction get "staticMGs");
private _dir = (getDir _building) - 90;
private _zpos = AGLToASL (_building buildingPos 1);
private _pos = _zpos getPos [0.5, _dir];
_pos = ASLToATL ([_pos select 0, _pos select 1, _zpos select 2]);
[_type, _pos, _dir] call _fnc_spawnStatic;
};
if ((_typeB == "Land_vn_hut_tower_01")) exitWith
{
private _type = selectRandom (_faction get "staticMGs");
private _dir = (getDir _building) - 180;
private _zpos = AGLToASL (_building buildingPos 5);
private _pos = _zpos getPos [1, _dir];
_pos = ASLToATL ([_pos select 0, _pos select 1, _zpos select 2]);
[_type, _pos, _dir] call _fnc_spawnStatic;
};
if ((_typeB == "Land_vn_o_platform_05") or (_typeB == "Land_vn_o_platform_06")) exitWith
{
private _type = selectRandom (_faction get "staticMGs");
private _dir = (getDir _building) - 270;
private _zpos = AGLToASL (_building buildingPos 5);
private _pos = _zpos getPos [0.5, _dir];
_pos = ASLToATL ([_pos select 0, _pos select 1, _zpos select 2]);
[_type, _pos, _dir] call _fnc_spawnStatic;
};
if ((_typeB == "Land_vn_b_trench_bunker_04_01")) exitWith
{
private _type = selectRandom (_faction get "staticMGs");
private _dir = (getDir _building) + 90;
private _zpos = AGLToASL (_building buildingPos 4);
private _pos = _zpos getPos [-1.5, _dir];
_pos = ASLToATL ([_pos select 0, _pos select 1, _zpos select 2]);
[_type, _pos, _dir] call _fnc_spawnStatic;
};
if ((_typeB == "Land_Cargo_Tower_V1_F") or (_typeB == "Land_Cargo_Tower_V1_No1_F") or (_typeB == "Land_Cargo_Tower_V1_No2_F") or (_typeB == "Land_Cargo_Tower_V1_No3_F") or (_typeB == "Land_Cargo_Tower_V1_No4_F") or (_typeB == "Land_Cargo_Tower_V1_No5_F") or (_typeB == "Land_Cargo_Tower_V1_No6_F") or (_typeB == "Land_Cargo_Tower_V1_No7_F") or (_typeB == "Land_Cargo_Tower_V2_F") or (_typeB == "Land_Cargo_Tower_V3_F") or (_typeB == "Land_Cargo_Tower_V4_F")) exitWith // just the big towers which have 3 .50 cals on top
{
private _type = selectRandom (_faction get "staticMGs");
_dir = getDir _building;
_zOffset = [0, 0, -0.3]; //fix spawn hight
_Tdir = _dir + 90; //relative rotation to building
_zpos = AGLToASL (_building buildingPos 11); //relative East
_pos = _zpos getPos [-1, _Tdir]; //offset
_zpos = _zpos vectorAdd _zOffset;
_pos = ASLToATL ([_pos select 0, _pos select 1, _zpos select 2]);
[_type, _pos, _Tdir] call _fnc_spawnStatic;
sleep 0.5; // why only here?
_Tdir = _dir + 0;
_zpos = AGLToASL (_building buildingPos 13); //relative North
_pos = _zpos getPos [-0.8, _Tdir]; //offset
_zpos = _zpos vectorAdd _zOffset;
_pos = ASLToATL ([_pos select 0, _pos select 1, _zpos select 2]);
[_type, _pos, _Tdir] call _fnc_spawnStatic;
sleep 0.5;
_Tdir = _dir + 180;
_zpos = AGLToASL (_building buildingPos 16); //relative South
_pos = _zpos getPos [-0.2, _Tdir]; //offset
_zpos = _zpos vectorAdd _zOffset;
_pos = ASLToATL ([_pos select 0, _pos select 1, _zpos select 2]);
[_type, _pos, _Tdir] call _fnc_spawnStatic;
};
if ((_typeB == "Land_SPE_Sandbag_Nest")) exitWith
{
private _type = selectRandom (_faction get "staticMGs");
private _dir = (getDir _building);
private _pos = _building modelToWorld [0.0065918,-0.489746,-0.417223];
[_type, _pos, _dir] call _fnc_spawnStatic;
};
//Static AAs
if ((_typeB == "Land_Radar_01_HQ_F") or (_typeB == "Land_vn_radar_01_hq_f")) exitWith
{
private _type = selectRandom (_faction get "staticAA");
private _dir = getDir _building;
private _zpos = AGLToASL (_building buildingPos 30);
private _pos = getPosASL _building;
_pos = ASLToATL ([_pos select 0, _pos select 1, _zpos select 2]);
[_type, _pos, _dir] call _fnc_spawnStatic;
};
if ((_typeB == "Land_Cargo_HQ_V1_F") or (_typeB == "Land_Cargo_HQ_V2_F") or (_typeB == "Land_Cargo_HQ_V3_F")) exitWith
{
private _type = selectRandom (_faction get "staticAA");
private _dir = getDir _building;
private _zpos = AGLToASL (_building buildingPos 8);
private _pos = getPosASL _building;
_pos = ASLToATL ([_pos select 0, _pos select 1, _zpos select 2]);
[_type, _pos, _dir] call _fnc_spawnStatic;
};
if ((_typeB == "Land_vn_cementworks_01_grey_f")) exitWith
{
private _type = selectRandom (_faction get "staticAA");
private _dir = getDir _building;
private _zpos = AGLToASL (_building buildingPos 24);
private _pos = getPosASL _building;
_pos = ASLToATL ([_pos select 0, _pos select 1, _zpos select 2]);
[_type, _pos, _dir] call _fnc_spawnStatic;
};
if ((_typeB == "Land_vn_cementworks_01_brick_f")) exitWith
{
private _type = selectRandom (_faction get "staticAA");
private _dir = getDir _building;
private _zpos = AGLToASL (_building buildingPos 20);
private _pos = getPosASL _building;
_pos = ASLToATL ([_pos select 0, _pos select 1, _zpos select 2]);
[_type, _pos, _dir] call _fnc_spawnStatic;
};
if ((_typeB == "Land_vn_a_office01")) exitWith
{
private _type = selectRandom (_faction get "staticAA");
private _dir = (getDir _building) + 180;
private _zpos = AGLToASL (_building buildingPos 8);
private _pos = _zpos getPos [1.5, _dir];
_pos = ASLToATL ([_pos select 0, _pos select 1, _zpos select 2]);
[_type, _pos, _dir] call _fnc_spawnStatic;
};
if (_typeB isEqualTo "land_gm_sandbags_02_bunker_high" or {_typeB isEqualTo "land_gm_woodbunker_01_bags"}) exitWith {
private _type = selectRandom (_faction get "staticMGs");
private _dir = getDir _building;
private _zpos = AGLToASL (position _building);
private _pos = _zpos getPos [0, _dir];
_pos = ASLToATL ([_pos select 0, _pos select 1, _zpos select 2]);
private _static = [_type, _pos, _dir] call _fnc_spawnStatic;
_static setPos _pos
};
if (_typeB isEqualTo "Land_HBarrier_01_big_tower_green_F" or {_typeB isEqualTo "Land_HBarrierTower_F"}) exitWith {
private _type = selectRandom (_faction get "staticMGs");
private _dir = (getDir _building) - 180;
private _zpos = AGLToASL (position _building);
private _zOffset = [0, 0, 2.55];
_zpos = _zpos vectorAdd _zOffset;
private _pos = _zpos getPos [1.5, _dir];
_pos = ASLToATL ([_pos select 0, _pos select 1, _zpos select 2]);
private _static = [_type, _pos, _dir] call _fnc_spawnStatic;
_static setPos _pos;
};
if (_typeB isEqualTo "Land_HBarrier_01_tower_green_F" or {_typeB isEqualTo "Land_BagBunker_Tower_F"}) exitWith {
private _type = selectRandom (_faction get "staticMGs");
private _dir = (getDir _building) - 180;
private _zpos = AGLToASL (position _building);
private _zOffset = [0, 0, 2.55];
_zpos = _zpos vectorAdd _zOffset;
private _pos = _zpos getPos [1.5, _dir];
_pos = ASLToATL ([_pos select 0, _pos select 1, _zpos select 2]);
private _static = [_type, _pos, _dir] call _fnc_spawnStatic;
_static setPos _pos;
};
if (_typeB isEqualTo "Land_Fort_Watchtower_EP1" or {_typeB isEqualTo "Land_Fort_Watchtower"}) exitWith {
private _type = selectRandom (_faction get "staticMGs");
private _dir = (getDir _building) - 180;
private _zpos = AGLToASL (position _building);
private _zOffset = [0, 0, 2.25];
_zpos = _zpos vectorAdd _zOffset;
private _pos = _zpos getPos [1.5, _dir];
_pos = ASLToATL ([_pos select 0, _pos select 1, _zpos select 2]);
private _static = [_type, _pos, _dir] call _fnc_spawnStatic;
_static setPos _pos;
};
if (_typeB in ["Land_BagBunker_Large_F", "Land_fortified_nest_big_EP1", "Land_fortified_nest_big", "Land_BagBunker_01_large_green_F", "Land_vn_bunker_big_01"]) exitWith {
private _type = selectRandom (_faction get "staticMGs");
private _dir = (getDir _building) - 180;
private _zpos = AGLToASL (_building buildingPos 4);
private _pos = _zpos getPos [2, _dir];
_pos = ASLToATL ([_pos select 0, _pos select 1, _zpos select 2]);
private _static = [_type, _pos, _dir] call _fnc_spawnStatic;
_static setPos _pos;
};
if (_typeB isEqualTo "Land_Bunker_01_big_F") exitWith {
private _type = selectRandom (_faction get "staticMGs");
private _dir = (getDir _building) - 180;
private _zpos = AGLToASL (_building buildingPos 2);
private _pos = _zpos getPos [-1, _dir];
_pos = ASLToATL ([_pos select 0, _pos select 1, _zpos select 2]);
private _static = [_type, _pos, _dir] call _fnc_spawnStatic;
_static setPos _pos;
_zpos = AGLToASL (_building buildingPos 5);
_pos = _zpos getPos [-1, _dir];
_pos = ASLToATL ([_pos select 0, _pos select 1, _zpos select 2]);
_static = [_type, _pos, _dir] call _fnc_spawnStatic;
_static setPos _pos;
};
if (_typeB isEqualTo "Land_Bunker_01_small_F") exitWith {
private _type = selectRandom (_faction get "staticMGs");
private _dir = (getDir _building) - 180;
private _zpos = AGLToASL (_building buildingPos 1);
private _pos = _zpos getPos [-1, _dir];
_pos = ASLToATL ([_pos select 0, _pos select 1, _zpos select 2]);
private _static = [_type, _pos, _dir] call _fnc_spawnStatic;
_static setPos _pos;
};
if (_typeB isEqualTo "Land_Bunker_01_tall_F") exitWith {
private _type = selectRandom (_faction get "staticMGs");
private _dir = (getDir _building) - 180;
private _zpos = AGLToASL (_building buildingPos 3);
private _pos = _zpos getPos [-1.5, _dir];
_pos = ASLToATL ([_pos select 0, _pos select 1, _zpos select 2]);
private _static = [_type, _pos, _dir] call _fnc_spawnStatic;
_static setPos _pos;
};
if (_typeB isEqualTo "land_gm_euro_misc_viewplatform_01") exitWith {
private _type = selectRandom (_faction get "staticAA");
private _dir = (getDir _building) - 180;
private _zpos = AGLToASL (position _building);
private _zOffset = [0, 0, 5.2];
_zpos = _zpos vectorAdd _zOffset;
private _pos = _zpos getPos [0.6, _dir];
_pos = ASLToATL ([_pos select 0, _pos select 1, _zpos select 2]);
private _static = [_type, _pos, _dir] call _fnc_spawnStatic;
_static setPos _pos;
};
if ((_typeB == "Land_WW2_Bunker_H679")) exitWith
{
private _type = selectRandom (_faction get "staticMGs");
private _dir = (getDir _building) - 90;
private _pos = _building modelToWorld [-1.8,0,0.555];
[_type, _pos, _dir] call _fnc_spawnStatic;
};
if ((_typeB == "Land_WW2_Bunker_Gun_R")) exitWith
{
private _type = selectRandom (_faction get "staticAT");
private _dir = (getDir _building) - 180;
private _pos = _building modelToWorld [0.2,0,0.3];
[_type, _pos, _dir] call _fnc_spawnStatic;
};
if ((_typeB == "Land_WW2_Bunker_Gun_L")) exitWith
{
private _type = selectRandom (_faction get "staticAT");
private _dir = (getDir _building) - 180;
private _pos = _building modelToWorld [0,0,0.3];
[_type, _pos, _dir] call _fnc_spawnStatic;
};
if ((_typeB == "Land_WW2_BET_Flak_Bettung")) exitWith
{
private _type = selectRandom (_faction get "staticAA");
private _dir = (getDir _building) - 45;
private _pos = _building modelToWorld [-1.2,1,0.2];
[_type, _pos, _dir] call _fnc_spawnStatic;
};
if ((_typeB == "Land_SPE_H667")) exitWith
{
private _type = selectRandom (_faction get "staticMGs");
private _dir = (getDir _building) - 180;
private _pos = _building modelToWorld [0,-0.1,0.3];
[_type, _pos, _dir] call _fnc_spawnStatic;
};
if ((_typeB == "Land_SPE_H612")) exitWith
{
private _type = selectRandom (_faction get "staticMGs");
private _dir = (getDir _building) - 180;
private _pos = _building modelToWorld [-0.3,-5,0.3];
[_type, _pos, _dir] call _fnc_spawnStatic;
};
if ((_typeB == "Land_SPE_H630")) exitWith
{
private _type = selectRandom (_faction get "staticMGs");
private _dir = (getDir _building) - 180;
private _pos = _building modelToWorld [0.8,-2.5,0.3];
[_type, _pos, _dir] call _fnc_spawnStatic;
};
if ((_typeB == "Land_SPE_H669")) exitWith
{
private _type = selectRandom (_faction get "staticAT");
private _dir = (getDir _building) - 180;
private _pos = _building modelToWorld [0,-3.2,0.3];
[_type, _pos, _dir] call _fnc_spawnStatic;
};
if ((_typeB == "Land_SPE_H679")) exitWith
{
private _type = selectRandom (_faction get "staticAT");
private _dir = (getDir _building) - 180;
private _pos = _building modelToWorld [-0.2,-2,0.3];
[_type, _pos, _dir] call _fnc_spawnStatic;
};
if ((_typeB == "LAND_uns_weapon_pit")) exitWith
{
private _type = selectRandom (_faction get "staticMGs");
private _dir = (getDir _building) - 180;
private _pos = _building modelToWorld [0.5,0.1,0.3];
[_type, _pos, _dir] call _fnc_spawnStatic;
};
if ((_typeB == "LAND_CSJ_gunpit")) exitWith
{
private _type = selectRandom (_faction get "staticAA");
private _dir = (getDir _building) - 90;
private _pos = _building modelToWorld [0,0,1.2];
[_type, _pos, _dir] call _fnc_spawnStatic;
};
if ((_typeB == "csj_VCbunk01")) exitWith
{
private _type = selectRandom (_faction get "staticMGs");
private _dir = (getDir _building) - 180;
private _pos = _building modelToWorld [0,0,-0.5];
[_type, _pos, _dir] call _fnc_spawnStatic;
};
if ((_typeB == "Land_Vil_Tower")) exitWith
{
private _type = selectRandom (_faction get "staticMGs");
private _dir = (getDir _building) - 180;
private _pos = _building modelToWorld [-0.5,-0.7,1.3];
[_type, _pos, _dir] call _fnc_spawnStatic;
};
};
};
//Spawning Marksmen on fixed buildingPos of chosen buildings
for "_i" from 0 to (count _buildings) - 1 do
{
if (spawner getVariable _markerX == 2) exitWith {};
private _building = _buildings select _i;
private _typeB = typeOf _building;
call {
if (isObjectHidden _building) exitWith {}; // don't put statics on destroyed buildings
if ((_typeB == "Land_vn_o_snipertree_01") or (_typeB == "Land_vn_o_snipertree_02") or (_typeB == "Land_vn_o_snipertree_03") or (_typeB == "Land_vn_o_snipertree_04") or (_typeB == "Land_vn_o_platform_01") or (_typeB == "Land_vn_o_platform_02") or (_typeB == "Land_vn_o_platform_03")) exitWith
{
private _type = _faction get "unitMarksman";
private _dir = (getDir _building) - 180;
private _zpos = AGLToASL (_building buildingPos 0);
private _pos = _zpos getPos [0, _dir]; // zeroes Z value because BIS
_pos = ASLToATL ([_pos select 0, _pos select 1, _zpos select 2]);
private _unit = [_type, _pos, _dir] call _fnc_spawnStaticUnit;
};
};
};
//Spawning Riflemen on fixed buildingPos of chosen buildings
for "_i" from 0 to (count _buildings) - 1 do
{
if (spawner getVariable _markerX == 2) exitWith {};
private _building = _buildings select _i;
private _typeB = typeOf _building;
call {
if (isObjectHidden _building) exitWith {}; // don't put statics on destroyed buildings
if (_typeB == "Land_vn_b_tower_01") exitWith {
private _type = selectRandom ([_faction, "unitTierGuard"] call SCRT_fnc_unit_flattenTier);
private _dir = (getDir _building) - 180;
private _zpos = AGLToASL (_building buildingPos 0);
private _pos = _zpos getPos [0, _dir]; // zeroes Z value because BIS
_pos = ASLToATL ([_pos select 0, _pos select 1, _zpos select 2]);
private _unit = [_type, _pos, _dir] call _fnc_spawnStaticUnit;
};
if (_typeB isEqualTo "Land_GuardTower_01_F" || {_typeB isEqualTo "Land_vn_guardtower_01_f" || {_typeB isEqualTo "Land_MobileRadar_01_radar_F"}}) exitWith {
private _type = selectRandom ([_faction, "unitTierTower"] call SCRT_fnc_unit_flattenTier);
private _dir = (getDir _building) - 180;
private _zpos = AGLToASL (_building buildingPos 2);
private _pos = _zpos getPos [0, _dir]; // zeroes Z value because BIS
_pos = ASLToATL ([_pos select 0, _pos select 1, _zpos select 2]);
private _unit = [_type, _pos, _dir] call _fnc_spawnStaticUnit;
};
if (_typeB isEqualTo "Land_GuardTower_02_F" ||
{_typeB isEqualTo "Land_vn_guardtower_02_f" ||
{_typeB isEqualTo "Land_vn_guardtower_03_f" ||
{_typeB isEqualTo "Land_vn_guardtower_04_f" ||
{_typeB isEqualTo "Land_Vez"
}}}}) exitWith {
private _type = selectRandom ([_faction, "unitTierGuard"] call SCRT_fnc_unit_flattenTier);
private _dir = getDir _building;
private _zpos = AGLToASL (_building buildingPos 0);
private _pos = _zpos getPos [-0.4, _dir];
_pos = ASLToATL ([_pos select 0, _pos select 1, _zpos select 2]);
private _unit = [_type, _pos, _dir] call _fnc_spawnStaticUnit;
};
if (_typeB isEqualTo "Land_GuardHouse_02_F" || {_typeB isEqualTo "Land_GuardHouse_02_grey_F"}) exitWith {
private _type = selectRandom ([_faction, "unitTierGuard"] call SCRT_fnc_unit_flattenTier);
private _dir = getDir _building;
private _zpos = AGLToASL (_building buildingPos 1);
private _pos = _zpos getPos [0, _dir]; // zeroes Z value because BIS
_pos = ASLToATL ([_pos select 0, _pos select 1, _zpos select 2]);
private _unit = [_type, _pos, _dir] call _fnc_spawnStaticUnit;
};
if (_typeB isEqualTo "Land_GuardBox_01_brown_F" ||
{_typeB isEqualTo "Land_GuardBox_01_green_F" ||
{_typeB isEqualTo "Land_GuardBox_01_smooth_F"
}}) exitWith {
private _type = selectRandom ([_faction, "unitTierGuard"] call SCRT_fnc_unit_flattenTier);
private _dir = (getDir _building) - 180;
private _zpos = AGLToASL (_building buildingPos 0);
private _pos = _zpos getPos [0, _dir]; // zeroes Z value because BIS
_pos = ASLToATL ([_pos select 0, _pos select 1, _zpos select 2]);
private _unit = [_type, _pos, _dir] call _fnc_spawnStaticUnit;
};
};
};
[_groupX,_vehiclesX,_soldiers,_spawnsUsed]