Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(count ep_locations < 1) exitWith{};
- diag_log [diag_frameno, diag_ticktime, time, "MISSION TASK MSO_AUTO.sqf"];
- private["_killtasktime","_AO","_location","_taskid","_position","_types","_unittypes","_unittype","_HVTgrp","_HVT","_cleared", "_activatedAOTypes"];
- // *** start of HACK for BL1P by zsawyer ***
- _activatedAOTypes = ["Camp", "AA", "RB", "Infantry", "Motorized", "Mechanized", "Armored"];
- _AOtype = "";
- while {-1 == _activatedAOTypes find _AOtype} do {
- _AO = (ep_locations call mps_getRandomElement);
- _AOtype = _AO select 0;
- diag_log format ["found AOtype: %1", _AOtype];
- hint format ["found AOtype: %1", _AOtype];
- sleep 2;
- };
- // *** end of HACK for BL1P by zsawyer ***
- _position = _AO select 1;
- _HVTgrp = nil;
- _HVT = nil;
- _killtasktime = 0;
- _taskid = format["%1%2%3",round (_position select 0),round (_position select 1),(round random 999)];
- sleep 1;
- _di = 1000;
- _neartwns = nearestLocations [_position, ["NameVillage","NameCity","NameCityCapital","NameLocal"], _di];
- while {count _neartwns < 1} do {
- _di = _di + 500;
- _neartwns = nearestLocations [_position, ["NameVillage","NameCity","NameCityCapital","NameLocal"], _di];
- };
- _nearesttwn = _neartwns select 0;
- switch (_AOtype) do {
- case "Camp": {
- _HVTgrp = creategroup EAST;
- "Land_dp_smallFactory_F" createUnit [_position, _HVTgrp];
- _HVT = leader _HVTgrp;
- _chkdist = 200;
- [
- format["TASK%1",_taskid],
- format["Eliminate High Value Target!", _taskid],
- format["We received HUMINT of an High Value Target (HVT) near %1! Eliminate the target Within 3 hrs!", text _nearesttwn],
- true,
- [format["MARK%1",_taskid],(_position),"hd_objective","ColorRedAlpha","Target"],
- "created",
- _position
- ] call mps_tasks_add;
- };
- case "AA": {
- _chkdist = 200;
- [
- format["TASK%1",_taskid],
- format["Take out AAA placement near %1!",text _nearesttwn],
- format["An hostile AAA camp was revealed in the area of %1! Take out all Hostiles in the AO!!!! You have 3hrs!",text _nearesttwn],
- true,
- [format["MARK%1",_taskid],(_position),"hd_objective","ColorRedAlpha","Target"],
- "created",
- _position
- ] call mps_tasks_add;
- };
- case "RB": {
- _chkdist = 150;
- [
- format["TASK%1",_taskid],
- format["Clear enemy roadblock in %1!",text _nearesttwn],
- format["We received HUMINT about a roadblock in the vicinity of %1! Recon the area and Take out all Hostiles in the AO!!!! You have 3hrs!!",text _nearesttwn],
- true,
- [format["MARK%1",_taskid],(_position),"hd_objective","ColorRedAlpha","Target"],
- "created",
- _position
- ] call mps_tasks_add;
- };
- case "Infantry": {
- _chkdist = 500;
- [
- format["TASK%1",_taskid],
- format ["Enemy troops movement in %1!",text _nearesttwn],
- format["We received HUMINT about troops in the area of %1! Recon the AO before to get an overview of the situation, Then take out all Hostiles in the AO!!!! You have 3hrs!!",text _nearesttwn],
- true,
- [format["MARK%1",_taskid],(_position),"hd_objective","ColorRedAlpha","Target"],
- "created",
- _position
- ] call mps_tasks_add;
- };
- case "Motorized": {
- _chkdist = 500;
- [
- format["TASK%1",_taskid],
- format ["Motorized groups spotted at %1!",text _nearesttwn],
- format["A motorized group was located in the vicinity of %1! Be sure to recon the AO before you attack! Take out all Hostiles in the AO!!!! You have 3hrs!",text _nearesttwn],
- true,
- [format["MARK%1",_taskid],(_position),"hd_objective","ColorRedAlpha","Target"],
- "created",
- _position
- ] call mps_tasks_add;
- };
- case "Mechanized": {
- _chkdist = 500;
- [
- format["TASK%1",_taskid],
- format ["Light armour spotted near %1!",text _nearesttwn],
- format["A mech group moves around near %1! Be sure to spot your primary target prior to Taking out all Hostiles in the AO!!!! You have 3hrs!",text _nearesttwn],
- true,
- [format["MARK%1",_taskid],(_position),"hd_objective","ColorRedAlpha","Target"],
- "created",
- _position
- ] call mps_tasks_add;
- };
- case "Armored": {
- _chkdist = 500;
- [
- format["TASK%1",_taskid],
- format ["Heavy tanks spotted near %1!",text _nearesttwn],
- format["Tanks have been spotted in the area of %1! Be sure to have AT weapons loaded and be sure to have reconned the AO! Primary goal is Take out all Hostiles in the AO!!!! You have 3hrs!",text _nearesttwn],
- true,
- [format["MARK%1",_taskid],(_position),"hd_objective","ColorRedAlpha","Target"],
- "created",
- _position
- ] call mps_tasks_add;
- };
- };
- _rmin = 0;
- _rmax = 1;
- _rplayers = 1 max (playersNumber (SIDE_A select 0));
- _ra = (_rmax-_rmin)/(mps_ref_playercount-1);
- _rb = _rmin - _ra;
- _diffresult = round(_rplayers * _ra + _rb);
- _b = (2 max (round (random (playersNumber (SIDE_A select 0) / 3)))) * MISSIONDIFF;
- _stance = ["patrol","hide"] call mps_getRandomElement;
- _grp = [_position,"INF",(5 + random 5),50,_stance ] call CREATE_OPFOR_SQUAD;
- if( _diffresult > 0.18 ) then { [_position] spawn CREATE_OPFOR_SNIPERS };
- sleep 0.3;
- _cleared = false;
- _cntr = 0;
- while {!(ABORTTASK) && (_killtasktime < 10800) && !(_cleared)} do {
- if ([_position, rmm_ep_spawn_dist] call fPlayersInside) then {
- sleep 2;
- _EnemyCnt = {(str(side _x) != "west") && (str(side _x) != "Civilian") && alive _x} count (nearestObjects [_position, ["CAManBase","Tank"], 500]);
- if (_EnemyCnt == 0) then {
- if (_cntr > 20) then {_cleared = true};
- _cntr = _cntr + 2;
- } else {
- _cntr = 0;
- };
- if !(isnil "_HVT") then {if !(alive _HVT) then {_cleared = true};};
- } else {
- _killtasktime = _killtasktime + 2;
- _cntr = 0;
- sleep 2;
- };
- };
- if (!ABORTTASK && _cleared) then {
- [format["TASK%1",_taskid],"succeeded"] call mps_tasks_upd;
- {deletevehicle _x} foreach _units;
- deletegroup _HVTgrp;
- _idx = [ep_locations, _AO] call BIS_fnc_arrayFindDeep;
- if (typename _idx == "ARRAY") then {
- _idx = _idx select 0;
- ep_locations set [_idx, ">REMOVE<"];
- ep_locations = ep_locations - [">REMOVE<"];
- };
- mps_mission_status = 2;
- } else {
- [format["TASK%1",_taskid],"failed"] call mps_tasks_upd;
- {deletevehicle _x} foreach (units _HVTgrp);
- deletegroup _HVTgrp;
- _idx = [ep_locations, _AO] call BIS_fnc_arrayFindDeep;
- _idx = _idx select 0;
- ep_locations set [_idx, ">REMOVE<"];
- ep_locations = ep_locations - [">REMOVE<"];
- mps_mission_status = 3;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement