Fixed stalling of this mission type

This commit is contained in:
IT07 2016-05-08 20:51:02 +02:00
parent 2d7cbc8b7e
commit e94919c4a5

View File

@ -5,12 +5,13 @@
A simple mission for VEMFr that sends a chopper to a player's territory and paradrops all units inside
*/
VEMFrMissionCount = VEMFrMissionCount + 1;
_missionName = param [0, "", [""]];
if isNil"VEMFrAttackCount" then { VEMFrAttackCount = 0 };
if (VEMFrAttackCount < ([[_missionName],["maxAttacks"]] call VEMFr_fnc_getSetting select 0)) then
VEMFrAttackCount = VEMFrAttackCount + 1;
if (VEMFrAttackCount <= ([[_missionName],["maxAttacks"]] call VEMFr_fnc_getSetting select 0)) then
{
scopeName "outer";
VEMFrAttackCount = VEMFrAttackCount + 1;
if (_missionName in ("missionList" call VEMFr_fnc_getSetting)) then
{
_aiSetup = ([[_missionName],["aiSetup"]] call VEMFr_fnc_getSetting) select 0;
@ -38,6 +39,7 @@ if (VEMFrAttackCount < ([[_missionName],["maxAttacks"]] call VEMFr_fnc_getSettin
_nearestPlayer = selectRandom (nearestObjects [_flagPos, ["Exile_Unit_Player"], 150]);
if not isNil"_nearestPlayer" then
{
_flagName = _flagToAttack getVariable ["exileterritoryname", "ERROR: UNKNOWN NAME"];
_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
{
@ -54,33 +56,29 @@ if (VEMFrAttackCount < ([[_missionName],["maxAttacks"]] call VEMFr_fnc_getSettin
_units = [];
{
_wp = _x addWaypoint [_flagPos, 50, 1];
_wp setWaypointType "SAD";
_wp setWaypointSpeed "FULL";
_wp setWaypointBehaviour "COMBAT";
_wp setWaypointCombatMode "RED";
_wp setWaypointBehaviour "AWARE";
_wp setWaypointCompletionRadius 10;
_wp setWaypointFormation "DIAMOND";
_wp setWaypointSpeed "FULL";
_wp setWaypointType "SAD";
_x setCurrentWaypoint _wp;
_wayPoints pushback _wp;
{
if (backpack _x isEqualTo "") then
{
removeBackpack _x;
};
_x addBackPack "B_Parachute";
_units pushback _x;
} forEach (units _x);
[_x] spawn VEMFr_fnc_signAI;
_signed = [_x] call VEMFr_fnc_signAI;
} forEach _paraGroups;
_nameOfTarget = name _nearestPlayer;
_players = nearestObjects [_flagPos, ["Exile_Unit_Player"], 275];
[[format["A paradrop team is on the way to %1's location!", _nameOfTarget],"BaseAttack", _players]] spawn VEMFr_fnc_broadCast;
["BaseAttack", 1, format["A paradrop team is on the way to %1's location!", name _nearestPlayer]] spawn VEMFr_fnc_log;
[[format["A para team is on the way to %1 @ %2's location!", _flagName, name _nearestPlayer],"BaseAttack", _players]] spawn VEMFr_fnc_broadCast;
["BaseAttack", 1, format["A para team is on the way to %1 @ %2's location!", _flagName, name _nearestPlayer]] spawn VEMFr_fnc_log;
while {true} do
{
scopeName "loop";
_deadCount = 0;
{
if not(alive _x) then
if (damage _x isEqualTo 1) then
{
_deadCount = _deadCount + 1;
};
@ -94,7 +92,7 @@ if (VEMFrAttackCount < ([[_missionName],["maxAttacks"]] call VEMFr_fnc_getSettin
};
};
_players = nearestObjects [_flagPos, ["Exile_Unit_Player"], 275];
[[format["Attack on %1's location has been stopped", _nameOfTarget],"SUCCESS", _players]] spawn VEMFr_fnc_broadCast;
[[format["Attack on %1 has been defeated", _flagname],"SUCCESS", _players]] spawn VEMFr_fnc_broadCast;
breakOut "outer";
} else
{
@ -139,6 +137,6 @@ if (VEMFrAttackCount < ([[_missionName],["maxAttacks"]] call VEMFr_fnc_getSettin
["BaseAttack", 0, format["Failed to start mission. Given _missionName (%1) is not in active missionList", _missionName]] spawn VEMFr_fnc_log;
breakOut "outer";
};
VEMFrAttackCount = VEMFrAttackCount - 1;
};
VEMFrAttackCount = VEMFrAttackCount - 1;
VEMFrMissionCount = VEMFrMissionCount - 1;