DMS_Exile/@ExileServer/addons/a3_dms/scripts/fn_SpawnBanditMission.sqf
eraser1 7a074042b1 Important restructuring, minor fix(es)
* CONFIG VALUES: Changed "DMS_MissionTypes" to "DMS_BanditMissionTypes"
* Renamed some variables to "future-proof" them
* Placed all current missions under "bandit" subfolder to for easier
future integration.
* Created function "DMS_fnc_SpawnBanditMission" to handle bandit mission
spawning (makes it easier to spawn missions via admin console).
* Attached vehicle eventhandlers to DMS-spawned non-persistent vehicles.
* Fixed the "lock" option appearing on DMS-spawned vehicles.
2015-09-20 23:42:33 -05:00

46 lines
1.2 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 ["_OK", "_missionType", "_parameters"];
_missionType = param [0, DMS_BanditMissionTypesArray call BIS_fnc_selectRandom, [""]];
if !(_missionType in DMS_BanditMissionTypesArray) then
{
diag_log format ["DMS ERROR :: Calling DMS_fnc_SpawnBanditMission for a mission that isn't in DMS_BanditMissionTypesArray! Parameters: %1",_this];
}
else
{
_parameters = [];
if ((count _this)>1) then
{
_parameters = _this select 1;
};
DMS_MissionCount = DMS_MissionCount + 1;
DMS_RunningBMissionCount = DMS_RunningBMissionCount + 1;
DMS_BMissionDelay = DMS_TimeBetweenMissions call DMS_fnc_SelectRandomVal;
_parameters call compile preprocessFileLineNumbers (format ["\x\addons\DMS\missions\bandit\%1.sqf",_missionType]);
DMS_BMissionLastStart = diag_tickTime;
if (DMS_DEBUG) then
{
diag_log format ["DMS_DEBUG SelectMission :: Spawned mission %1 with parameters (%2) | DMS_BMissionDelay set to %3 seconds",str _missionType,_parameters,DMS_BMissionDelay];
};
};