a3_vemf_reloaded/exile_vemf_reloaded/missions/BaseAttack.sqf

132 lines
5.6 KiB
Plaintext
Raw Normal View History

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-07-02 14:24:53 +00:00
_mn = param [0, "", [""]];
if (isNil "VEMFrAttackCount") then { VEMFrAttackCount = 0 };
2016-05-08 18:51:02 +00:00
VEMFrAttackCount = VEMFrAttackCount + 1;
2016-07-02 14:24:53 +00:00
_s = [[_mn],["maxAttacks","aiSetup","minimumLevel"]] call VEMFr_fnc_config;
_s params ["_s0","_s1","_s2"];
if (VEMFrAttackCount <= _s0) then
2016-04-16 21:40:54 +00:00
{
scopeName "outer";
2016-07-02 14:24:53 +00:00
if (_mn in ("missionList" call VEMFr_fnc_config)) then
2016-04-16 21:40:54 +00:00
{
2016-07-02 14:24:53 +00:00
if (((_s1 select 0) > 0) AND ((_s1 select 1) > 0)) then
2016-04-16 21:40:54 +00:00
{
2016-07-02 14:24:53 +00:00
_hst = uiNamespace getVariable ["VEMFrAttackedFlags",[]];
_objs = [];
2016-04-16 21:40:54 +00:00
{
2016-06-23 20:39:04 +00:00
if (((speed _x) < 25) AND ((vehicle _x) isEqualTo _x)) then
2016-04-16 21:40:54 +00:00
{
{
2016-07-02 14:24:53 +00:00
if (not(_x in _hst) AND ((_x getVariable ["ExileTerritoryLevel",0]) > _s2)) then { _objs pushBack _x };
} forEach (nearestObjects [position _x, ["Exile_Construction_Flag_Static"], 150]);
2016-04-16 21:40:54 +00:00
};
} forEach allPlayers;
2016-06-23 20:39:04 +00:00
2016-07-02 14:24:53 +00:00
if (count _objs > 0) then
2016-04-16 21:40:54 +00:00
{
2016-07-02 14:24:53 +00:00
_flg = selectRandom _objs;
_hst pushBack _flg;
_pos = position _flg;
_nrPlyr = selectRandom (nearestObjects [_pos, ["Exile_Unit_Player"], 150]);
if not(isNil "_nrPlyr") then
2016-04-16 21:40:54 +00:00
{
2016-07-02 14:24:53 +00:00
_flgNm = _flg getVariable ["exileterritoryname", "ERROR: UNKNOWN NAME"];
_prGrps = [_pos, _s1 select 0, _s1 select 1, ([[_mn],["aiMode"]] call VEMFr_fnc_config select 0), _mn, 1000 + (random 1000), 150] call VEMFr_fnc_spawnVEMFrAI;
if not(isNil "_prGrps") then
2016-04-16 21:40:54 +00:00
{
2016-07-02 14:24:53 +00:00
_ntCnt = 0;
2016-04-16 21:40:54 +00:00
{
2016-07-02 14:24:53 +00:00
if (count (units _x) isEqualTo (_s1 select 1)) then
2016-04-16 21:40:54 +00:00
{
2016-07-02 14:24:53 +00:00
_ntCnt = _ntCnt + (count(units _x));
2016-04-16 21:40:54 +00:00
};
2016-07-02 14:24:53 +00:00
} forEach _prGrps;
if (_ntCnt isEqualTo ((_s1 select 0) * (_s1 select 1))) then
2016-04-16 21:40:54 +00:00
{
2016-07-02 14:24:53 +00:00
_wyPnts = [];
_nts = [];
2016-04-16 21:40:54 +00:00
{
2016-07-02 14:24:53 +00:00
_wp = _x addWaypoint [_pos, 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;
2016-07-02 14:24:53 +00:00
_wyPnts pushback _wp;
2016-04-16 21:40:54 +00:00
{
2016-07-02 14:24:53 +00:00
_nts pushback _x;
2016-04-16 21:40:54 +00:00
} forEach (units _x);
2016-06-02 21:20:00 +00:00
[_x] ExecVM "exile_vemf_reloaded\sqf\signAI.sqf";
2016-07-02 14:24:53 +00:00
} forEach _prGrps;
_plyrs = nearestObjects [_pos, ["Exile_Unit_Player"], 275];
[-1, "NEW BASE ATTACK", format["A para team is on the way to %1 @ %2's location!", _flgNm, name _nrPlyr], _plyrs] ExecVM "exile_vemf_reloaded\sqf\notificationToClient.sqf";
["BaseAttack", 1, format["A para team is on the way to %1 @ %2's location!", _flgNm, name _nrPlyr]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
2016-04-16 21:40:54 +00:00
while {true} do
{
scopeName "loop";
2016-07-02 14:24:53 +00:00
_ddCnt = 0;
2016-04-16 21:40:54 +00:00
{
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
{
2016-07-02 14:24:53 +00:00
_ddCnt = _ddCnt + 1;
2016-04-16 21:40:54 +00:00
};
2016-07-02 14:24:53 +00:00
} forEach _nts;
if (_ddCnt isEqualTo _ntCnt) then
2016-04-16 21:40:54 +00:00
{
breakOut "loop";
} else
{
uiSleep 4;
};
};
2016-07-02 14:24:53 +00:00
_plyrs = nearestObjects [_pos, ["Exile_Unit_Player"], 275];
[-1, "DEFEATED", format["Base attack on %1 has been defeated!", _flgNm], _plyrs] ExecVM "exile_vemf_reloaded\sqf\notificationToClient.sqf";
2016-04-16 21:40:54 +00:00
breakOut "outer";
} else
{
{
{
deleteVehicle _x;
} forEach (units _x);
2016-07-02 14:24:53 +00:00
} forEach _prGrps;
["BaseAttack", 0, format["Incorrect amount of total units (%1). Should be %2", _ntCnt, (_s1 select 0) * (_s1 select 1)]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
2016-04-16 21:40:54 +00:00
breakOut "outer";
};
} else
{
2016-07-02 14:24:53 +00:00
["BaseAttack", 0, format["Incorrect spawned group count (%1). Should be %2", count _prGrps, _s1 select 0]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
2016-04-16 21:40:54 +00:00
breakOut "outer";
};
} else
{
2016-07-02 14:24:53 +00:00
_hst deleteAt (_hst find _flg);
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-07-02 14:24:53 +00:00
["BaseAttack", 0, format["invalid aiSetup setting! (%1)", _s1]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
2016-04-16 21:40:54 +00:00
breakOut "outer";
};
} else
{
2016-07-02 14:24:53 +00:00
["BaseAttack", 0, format["Failed to start mission. Given _mn (%1) is not in active missionList", _mn]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
2016-04-16 21:40:54 +00:00
};
};
2016-05-08 18:51:02 +00:00
VEMFrAttackCount = VEMFrAttackCount - 1;
2016-04-18 17:31:53 +00:00
VEMFrMissionCount = VEMFrMissionCount - 1;