Advertisement
Thatguy5532

Untitled

May 22nd, 2023 (edited)
524
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 2.57 KB | None | 0 0
  1. span class="re5"> params ["_trigger", "_marker"];
  2. private ["_aiLimit", "_garrisonLimit", "_vehLimit", "_houses", "_unitArr", "_vehArr", "_unitObjs"];
  3.  
  4. diag_log format["[TRA] Activating Military Zone: %1", markerText _marker];
  5.  
  6. _aiLimit = round(TRA_maxAiActive / TRA_maxZonesActive);
  7. _garrisonLimit = round(TRA_percentGarrisoned * _aiLimit);
  8. _vehLimit = round(TRA_percentVehicle * _aiLimit);
  9.  
  10. _houses = nearestObjects[getMarkerPos _marker, ["house"], TRA_milCaptureRadius];
  11. _unitObjs = [];
  12.  
  13. // Get units to spawn according to awareness
  14. if (TRA_enemyAwareness <= 100) then {
  15.     _unitArr = TRA_sectorDefendersInf get "high";
  16.     _vehArr = TRA_sectorDefendersVeh get "high";
  17. };
  18.  
  19. if (TRA_enemyAwareness <= 60) then {
  20.     _unitArr = TRA_sectorDefendersInf get "medium";
  21.     _vehArr = TRA_sectorDefendersVeh get "medium";
  22. };
  23.  
  24. if (TRA_enemyAwareness <= 30) then {
  25.     _unitArr = TRA_sectorDefendersInf get "low";
  26.     _vehArr = TRA_sectorDefendersVeh get "low";
  27. };
  28.  
  29. // Spawn Patrolling Infantry
  30. for "_i" from 0 to round((_aiLimit - (_garrisonLimit + _vehLimit)) / 5) do {
  31.     _group = createGroup TRA_enemySide;
  32.     _squadPos = (getMarkerPos _marker) getPos [random TRA_milCaptureRadius, random 360];
  33.     _unitObjs pushback (_group createUnit [selectRandom _unitArr, _squadPos, [], 0, "FORM"]);
  34.     _unitObjs pushback (_group createUnit [selectRandom _unitArr, _squadPos, [], 0, "FORM"]);
  35.     _unitObjs pushback (_group createUnit [selectRandom _unitArr, _squadPos, [], 0, "FORM"]);
  36.     _unitObjs pushback (_group createUnit [selectRandom _unitArr, _squadPos, [], 0, "FORM"]);
  37.     _unitObjs pushback (_group createUnit [selectRandom _unitArr, _squadPos, [], 0, "FORM"]);
  38.  
  39.     [_group, _squadPos, TRA_milCaptureRadius / 2] call lambs_wp_fnc_taskPatrol;
  40. };
  41.  
  42. // Spawn Garrisoning Infantry
  43. for "_i" from 0 to _garrisonLimit do {
  44.     _group = createGroup TRA_enemySide;
  45.     _squadPos = (getMarkerPos _marker) getPos [random TRA_milCaptureRadius, random 360];
  46.     _unitObjs pushback (_group createUnit [selectRandom _unitArr, _squadPos, [], 0, "FORM"]);
  47.     _unitObjs pushback (_group createUnit [selectRandom _unitArr, _squadPos, [], 0, "FORM"]);
  48.    
  49.     [_group, _squadPos, TRA_milCaptureRadius / 2] call lambs_wp_fnc_taskGarrison;
  50. };
  51.  
  52. // Spawn Vehicles
  53. for "_i" from 0 to _vehLimit do {  
  54.     _spawnPos = (getMarkerPos _marker) getPos [random TRA_milCaptureRadius, random 360];
  55.     _veh = [_spawnPos, random 360, selectRandom _vehArr, TRA_enemySide] call BIS_fnc_spawnVehicle;
  56.     _unitObjs pushback (_veh select 0);
  57.  
  58.     [_veh, _spawnPos, TRA_milCaptureRadius / 2] call lambs_wp_fnc_taskPatrol;
  59. };
  60.  
  61. _trigger setVariable [format["%1%2", _marker, "_units"], _unitObjs, true];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement