DMS_Exile/@ExileServer/addons/a3_dms/scripts/fn_SpawnBanditMission.sqf
eraser1 e3d11a0aa5 Initial Test Branch Commit
Lots of optimizations...
2016-05-06 22:44:48 -05:00

45 lines
1.1 KiB
Plaintext

/*
DMS_fnc_SpawnBanditMission
Created by eraser1
Usage:
[
_missionType,
_parameters
] call DMS_fnc_SpawnBanditMission;
Simply spawns a mission with the given mission type and passes parameters to it. Returns nothing
*/
private _mission =
[
missionNamespace getVariable format
[
"DMS_Mission_%1",
_this param [0,selectRandom DMS_BanditMissionTypesArray, [""]]
]
] param [0, "no",[{}]];
if (_mission isEqualTo "no") then
{
diag_log format ["DMS ERROR :: Calling DMS_fnc_SpawnBanditMission for a mission that isn't in DMS_BanditMissionTypesArray! Parameters: %1",_this];
}
else
{
private _parameters = if ((count _this)>1) then {_this select 1} else {[]};
DMS_MissionCount = DMS_MissionCount + 1;
DMS_RunningBMissionCount = DMS_RunningBMissionCount + 1;
DMS_BMissionDelay = DMS_TimeBetweenMissions call DMS_fnc_SelectRandomVal;
_parameters call _mission;
DMS_BMissionLastStart = diag_tickTime;
if (DMS_DEBUG) then
{
(format ["SpawnBanditMission :: Spawned mission %1 with parameters (%2) | DMS_BMissionDelay set to %3 seconds", _mission, _parameters, DMS_BMissionDelay]) call DMS_fnc_DebugLog;
};
};