2016-04-16 21:40:54 +00:00
/*
Author: IT07
Description:
A simple mission for VEMFr that sends a chopper to a player's territory and paradrops all units inside
*/
2016-05-08 18:51:02 +00:00
VEMFrMissionCount = VEMFrMissionCount + 1;
2016-04-16 21:40:54 +00:00
_missionName = param [0, "", [""]];
if isNil"VEMFrAttackCount" then { VEMFrAttackCount = 0 };
2016-05-08 18:51:02 +00:00
VEMFrAttackCount = VEMFrAttackCount + 1;
if (VEMFrAttackCount <= ([[_missionName],["maxAttacks"]] call VEMFr_fnc_getSetting select 0)) then
2016-04-16 21:40:54 +00:00
{
scopeName "outer";
if (_missionName in ("missionList" call VEMFr_fnc_getSetting)) then
{
_aiSetup = ([[_missionName],["aiSetup"]] call VEMFr_fnc_getSetting) select 0;
if (_aiSetup select 0 > 0 AND _aiSetup select 1 > 0) then
{
_attackedFlags = uiNamespace getVariable ["VEMFrAttackedFlags",[]];
_flags = [];
{
if (speed _x < 25 AND (vehicle _x isEqualTo _x)) then
{
2016-05-06 11:09:03 +00:00
_flagsObjs = nearestObjects [position _x, ["Exile_Construction_Flag_Static"], 150];
2016-04-16 21:40:54 +00:00
{
2016-05-06 11:09:03 +00:00
if not(_x in _attackedFlags) then
{
_flags pushBack _x;
};
2016-05-07 14:11:06 +00:00
} forEach _flagsObjs;
2016-04-16 21:40:54 +00:00
};
} forEach allPlayers;
if (count _flags > 0) then
{
_flagToAttack = selectRandom _flags;
_attackedFlags pushBack _flagToAttack;
_flagPos = position _flagToAttack;
_nearestPlayer = selectRandom (nearestObjects [_flagPos, ["Exile_Unit_Player"], 150]);
if not isNil"_nearestPlayer" then
{
2016-05-08 18:51:02 +00:00
_flagName = _flagToAttack getVariable ["exileterritoryname", "ERROR: UNKNOWN NAME"];
2016-04-16 21:40:54 +00:00
_paraGroups = [_flagPos, _aiSetup select 0, _aiSetup select 1, ([[_missionName],["aiMode"]] call VEMFr_fnc_getSetting select 0), _missionName, 1000 + (random 1000), 150] call VEMFr_fnc_spawnVEMFrAI;
if (count _paraGroups isEqualTo (_aiSetup select 0)) then
{
_unitCount = 0;
{
if (count (units _x) isEqualTo (_aiSetup select 1)) then
{
_unitCount = _unitCount + (count(units _x));
};
} forEach _paraGroups;
if (_unitCount isEqualTo ((_aiSetup select 0) * (_aiSetup select 1))) then
{
_wayPoints = [];
_units = [];
{
_wp = _x addWaypoint [_flagPos, 50, 1];
2016-05-08 18:51:02 +00:00
_wp setWaypointBehaviour "COMBAT";
2016-04-16 21:40:54 +00:00
_wp setWaypointCombatMode "RED";
2016-05-08 18:51:02 +00:00
_wp setWaypointCompletionRadius 10;
_wp setWaypointFormation "DIAMOND";
_wp setWaypointSpeed "FULL";
_wp setWaypointType "SAD";
2016-04-16 21:40:54 +00:00
_x setCurrentWaypoint _wp;
_wayPoints pushback _wp;
{
_units pushback _x;
} forEach (units _x);
2016-05-08 18:51:02 +00:00
_signed = [_x] call VEMFr_fnc_signAI;
2016-04-16 21:40:54 +00:00
} forEach _paraGroups;
_players = nearestObjects [_flagPos, ["Exile_Unit_Player"], 275];
2016-05-10 12:18:49 +00:00
[[format["A para team is on the way to %1 @ %2's location!", _flagName, name _nearestPlayer],"BaseAttack", _players]] ExecVM "exile_vemf_reloaded\sqf\broadCast.sqf";
["BaseAttack", 1, format["A para team is on the way to %1 @ %2's location!", _flagName, name _nearestPlayer]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
2016-04-16 21:40:54 +00:00
while {true} do
{
scopeName "loop";
_deadCount = 0;
{
2016-05-10 12:22:01 +00:00
if (damage _x isEqualTo 1 OR isNull _x) then
2016-04-16 21:40:54 +00:00
{
_deadCount = _deadCount + 1;
};
} forEach _units;
if (_deadCount isEqualTo _unitCount) then
{
breakOut "loop";
} else
{
uiSleep 4;
};
};
_players = nearestObjects [_flagPos, ["Exile_Unit_Player"], 275];
2016-05-10 12:18:49 +00:00
[[format["Attack on %1 has been defeated", _flagname],"SUCCESS", _players]] ExecVM "exile_vemf_reloaded\sqf\broadCast.sqf";
2016-04-16 21:40:54 +00:00
breakOut "outer";
} else
{
{
{
deleteVehicle _x;
} forEach (units _x);
} forEach _paraGroups;
2016-05-10 12:18:49 +00:00
["BaseAttack", 0, format["Incorrect amount of total units (%1). Should be %2", _unitCount, (_aiSetup select 0) * (_aiSetup select 1)]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
2016-04-16 21:40:54 +00:00
breakOut "outer";
};
} else
{
2016-05-10 12:18:49 +00:00
["BaseAttack", 0, format["Incorrect spawned group count (%1). Should be %2", count _paraGroups, _aiSetup select 0]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
2016-04-16 21:40:54 +00:00
breakOut "outer";
};
} else
{
_index = _attackedFlags find _flagToAttack;
if (_index > -1) then
{
_attackedFlags deleteAt _index;
2016-05-10 12:18:49 +00:00
["BaseAttack", 1, "Flag deleted from attackedFlag array"] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
2016-04-16 21:40:54 +00:00
} else
{
2016-05-10 12:18:49 +00:00
["BaseAttack", 0, "Unable to locate and remove attacked flag!"] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
2016-04-16 21:40:54 +00:00
};
2016-05-10 12:18:49 +00:00
["BaseAttack", 0, "Can not find player near flag!"] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
2016-04-16 21:40:54 +00:00
breakOut "outer";
};
} else
{
breakOut "outer";
};
} else
{
2016-05-10 12:18:49 +00:00
["BaseAttack", 0, format["invalid aiSetup setting! (%1)", _aiSetup]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
2016-04-16 21:40:54 +00:00
breakOut "outer";
};
} else
{
2016-05-10 12:18:49 +00:00
["BaseAttack", 0, format["Failed to start mission. Given _missionName (%1) is not in active missionList", _missionName]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
2016-04-16 21:40:54 +00:00
breakOut "outer";
};
};
2016-05-08 18:51:02 +00:00
VEMFrAttackCount = VEMFrAttackCount - 1;
2016-04-18 17:31:53 +00:00
VEMFrMissionCount = VEMFrMissionCount - 1;