DMS_Exile/@ExileServer/addons/a3_dms/scripts/fn_MissionSuccessState.sqf

63 lines
1.3 KiB
Plaintext
Raw Normal View History

/*
DMS_fnc_MissionSuccessState
Created by eraser1
Usage:
[
[_completionType1,_completionArgs1],
[_completionType2,_completionArgs2],
...
[_completionTypeN,_completionArgsN]
] call DMS_fnc_MissionSuccessState;
*/
if !((typeName _this) == "ARRAY") exitWith
{
diag_log format ["DMS ERROR :: DMS_MissionSuccessState called with invalid parameter: %1",_this];
};
private "_success";
_success = true;
{
if (!_success) exitWith
{
if (DMS_DEBUG) then
{
2015-09-01 22:37:29 +00:00
diag_log format ["DMS_DEBUG MissionSuccessState :: Mission not yet completed with parameters: %1 | at time %2",_this,diag_tickTime];
};
};
private ["_OK","_completionType","_completionArgs"];
_OK = _x params
[
["_completionType", "", [""] ],
["_completionArgs", [], [[],grpNull] ]
];
if (!_OK) exitWith
{
diag_log format ["DMS ERROR :: DMS_MissionSuccessState has invalid parameters in: %1",_x];
};
switch (_completionType) do
{
// Using switch-do so that future cases can be added easily
case "kill":
{
_success = _completionArgs call DMS_fnc_TargetsKilled;
};
case "killPercent":
{
_success = _completionArgs call DMS_fnc_TargetsKilledPercent;//<---TODO
};
case "playerNear":
{
2015-09-05 06:03:20 +00:00
_success = _completionArgs call DMS_fnc_IsPlayerNearby;
};
};
2015-09-04 16:35:19 +00:00
} forEach _this;
_success;