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", "_infSquadSize", "_garSquadSize"];
- diag_log format["[TRA] Activating Military Zone: %1", markerText _marker];
- /* Total ai should be distributed equally among max amount of zones active */
- _aiLimit = round(TRA_maxAiActive / TRA_maxZonesActive);
- _garrisonLimit = round(TRA_percentGarrisoned * _aiLimit);
- _vehLimit = round(TRA_percentVehicle * _aiLimit);
- /* Remove the ai that will become vehicles or be garrisoning from infantry limit */
- _aiLimit = _aiLimit - _garrisonLimit;
- _aiLimit = _aiLimit - _vehLimit;
- _unitObjs = [];
- _infSquadSize = 5;
- _garSquadSize = 3;
- // 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";
- };
- diag_log format["[TRA] Infantry Limit: %1", _aiLimit];
- for "_i" from 1 to round(_aiLimit / _infSquadSize) do {
- _group = createGroup TRA_enemySide;
- _squadPos = (getMarkerPos _marker) getPos [random TRA_milCaptureRadius, random 360];
- [_unitObjs, _group, _unitArr, _squadPos] spawn {
- params ["_unitObjs", "_group", "_unitArr", "_squadPos"];
- for "_j" from 1 to 5 do {
- _unitObjs pushback (_group createUnit [selectRandom _unitArr, _squadPos, [], 0, "FORM"]);
- sleep (((abs(50 - diag_fps) / (50 - 20))^2) * 2);
- };
- [_group, _squadPos, TRA_milCaptureRadius / 2] call lambs_wp_fnc_taskPatrol;
- };
- };
- for "_i" from 1 to round(_garrisonLimit / _garSquadSize) do {
- _group = createGroup TRA_enemySide;
- _squadPos = (getMarkerPos _marker) getPos [random TRA_milCaptureRadius, random 360];
- [_unitObjs, _group, _unitArr, _squadPos] spawn {
- params ["_unitObjs", "_group", "_unitArr", "_squadPos"];
- for "_j" from 1 to 3 do {
- _unitObjs pushback (_group createUnit [selectRandom _unitArr, _squadPos, [], 0, "FORM"]);
- sleep (((abs(50 - diag_fps) / (50 - 20))^2) * 2);
- };
- [_group, _squadPos, TRA_milCaptureRadius / 2] call lambs_wp_fnc_taskGarrison;
- };
- };
- for "_i" from 1 to _vehLimit do {
- _spawnPos = (getMarkerPos _marker) getPos [random TRA_milCaptureRadius, random 360];
- _spawnPos = _spawnPos findEmptyPosition [10, 100];
- [_spawnPos, _vehArr, _unitObjs] spawn {
- params ["_spawnPos", "_vehArr", "_unitObjs"];
- _veh = ([_spawnPos, random 360, selectRandom _vehArr, TRA_enemySide] call BIS_fnc_spawnVehicle);
- _unitObjs append (crew (_veh select 0));
- _unitObjs pushback (_veh select 0);
- [_veh select 0, _spawnPos, TRA_milCaptureRadius] call lambs_wp_fnc_taskPatrol;
- };
- sleep (((abs(50 - diag_fps) / (50 - 20))^2) * 2);
- };
- _trigger setVariable [format["%1%2", _marker, "_units"], _unitObjs, true];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement