Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- span class="re5"> params ["_trigger", "_marker"];
- private ["_aiLimit", "_garrisonLimit", "_vehLimit", "_houses", "_unitArr", "_vehArr", "_unitObjs"];
- diag_log format["[TRA] Activating Military Zone: %1", markerText _marker];
- _aiLimit = round(TRA_maxAiActive / TRA_maxZonesActive);
- _garrisonLimit = round(TRA_percentGarrisoned * _aiLimit);
- _vehLimit = round(TRA_percentVehicle * _aiLimit);
- _houses = nearestObjects[getMarkerPos _marker, ["house"], TRA_milCaptureRadius];
- _unitObjs = [];
- // Get units to spawn according to awareness
- if (TRA_enemyAwareness <= 100) then {
- _unitArr = TRA_sectorDefendersInf get "high";
- _vehArr = TRA_sectorDefendersVeh get "high";
- };
- if (TRA_enemyAwareness <= 60) then {
- _unitArr = TRA_sectorDefendersInf get "medium";
- _vehArr = TRA_sectorDefendersVeh get "medium";
- };
- if (TRA_enemyAwareness <= 30) then {
- _unitArr = TRA_sectorDefendersInf get "low";
- _vehArr = TRA_sectorDefendersVeh get "low";
- };
- // Spawn Patrolling Infantry
- for "_i" from 0 to round((_aiLimit - (_garrisonLimit + _vehLimit)) / 5) do {
- _group = createGroup TRA_enemySide;
- _squadPos = (getMarkerPos _marker) getPos [random TRA_milCaptureRadius, random 360];
- _unitObjs pushback (_group createUnit [selectRandom _unitArr, _squadPos, [], 0, "FORM"]);
- _unitObjs pushback (_group createUnit [selectRandom _unitArr, _squadPos, [], 0, "FORM"]);
- _unitObjs pushback (_group createUnit [selectRandom _unitArr, _squadPos, [], 0, "FORM"]);
- _unitObjs pushback (_group createUnit [selectRandom _unitArr, _squadPos, [], 0, "FORM"]);
- _unitObjs pushback (_group createUnit [selectRandom _unitArr, _squadPos, [], 0, "FORM"]);
- [_group, _squadPos, TRA_milCaptureRadius / 2] call lambs_wp_fnc_taskPatrol;
- };
- // Spawn Garrisoning Infantry
- for "_i" from 0 to _garrisonLimit do {
- _group = createGroup TRA_enemySide;
- _squadPos = (getMarkerPos _marker) getPos [random TRA_milCaptureRadius, random 360];
- _unitObjs pushback (_group createUnit [selectRandom _unitArr, _squadPos, [], 0, "FORM"]);
- _unitObjs pushback (_group createUnit [selectRandom _unitArr, _squadPos, [], 0, "FORM"]);
- [_group, _squadPos, TRA_milCaptureRadius / 2] call lambs_wp_fnc_taskGarrison;
- };
- // Spawn Vehicles
- for "_i" from 0 to _vehLimit do {
- _spawnPos = (getMarkerPos _marker) getPos [random TRA_milCaptureRadius, random 360];
- _veh = [_spawnPos, random 360, selectRandom _vehArr, TRA_enemySide] call BIS_fnc_spawnVehicle;
- _unitObjs pushback (_veh select 0);
- [_veh, _spawnPos, TRA_milCaptureRadius / 2] call lambs_wp_fnc_taskPatrol;
- };
- _trigger setVariable [format["%1%2", _marker, "_units"], _unitObjs, true];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement