2023-09-23 14:05:31 +00:00
/*
GMS_fnc_addMissionToQue
Adds the basic list of parameters that define a mission such as the marker name, mission list, mission path, AI difficulty, and timer settings, to the arrays that the main thread inspects.
By Ghostrider-GRG-
Copyright 2016
*/
2023-11-01 01:57:49 +00:00
#include "\x\addons\GMS\Compiles\Init\GMS_defines.hpp"
2023-09-25 19:54:52 +00:00
params[["_missionList",[]],["_path",""],["_marker",""],["_difficulty","Red"],["_tMin",60],["_tMax",120],["_noMissions",1],["_isStatic",false]];
2023-10-03 00:05:16 +00:00
//diag_log format["_addMissionToQue: _this = %1",_this];
2023-10-15 18:53:11 +00:00
//{
2023-10-16 19:35:01 +00:00
// diag_log format["_addMissionToQue: _this %1 = %2",_forEachIndex, _this select _forEachIndex];
2023-10-15 18:53:11 +00:00
//} forEach _this;
2023-10-03 00:05:16 +00:00
2023-09-25 19:54:52 +00:00
private "_waitTime";
if (_isStatic) then {
_waitTime = 60;
} else {
_waitTime = diag_tickTime + (_tMin) + random((_tMax) - (_tMin));
2023-09-23 14:05:31 +00:00
};
2023-09-25 19:54:52 +00:00
2023-10-16 19:35:01 +00:00
//diag_log format["_addMissionToQue: _waitTime = %1",_waitTime];
2023-09-25 19:54:52 +00:00
2023-10-25 23:53:01 +00:00
private "_missionFile";
2023-09-25 19:54:52 +00:00
2023-09-23 14:05:31 +00:00
private _missionsData = []; // Parameters definine each of the missions for this difficulty are stored as arrays here.
{
2023-11-01 01:57:49 +00:00
_missionFile = format["\x\addons\GMS\Missions\%1\%2.sqf",_path,_x];
2023-10-25 23:53:01 +00:00
if (GMS_debugLevel > 0) then {[format["_addMissionToQue: adding %1 mission with fileName %2",_difficulty,_missionFile]] call GMS_fnc_log};
2023-09-23 14:05:31 +00:00
private _missionCode = compileFinal preprocessFileLinenumbers _missionFile;//return all of the values that define how the mission is spawned as an array of values
if !(isNil "_missionCode") then
{
private _data = [_marker,_difficulty] call _missionCode;
if !(isNil "_data") then
{
_missionsData pushBack _data;
2023-10-16 19:35:01 +00:00
//diag_log format["_addMissionToQue: _data = %1",_data];
2023-09-23 14:05:31 +00:00
};
} else {
2023-10-16 19:35:01 +00:00
//diag_log format["bad path\mission combination %1",_missionFile];
2023-09-23 14:05:31 +00:00
};
} forEach _missionList;
2023-09-25 19:54:52 +00:00
2023-09-23 14:05:31 +00:00
private _key = round(random(10000));
private _missions = [
_key,
_difficulty,
_noMissions, // Max no missions of this category
0, // Number active
_tMin, // Used to calculate waittime in the future
_tMax, // as above
_waitTime, // time at which a mission should be spawned
2023-09-25 19:54:52 +00:00
_missionsData, // Array of data about individual missions that could be spawned. The data table for each mission is defined in _missionSpawner
2023-10-25 23:53:01 +00:00
_isStatic,
_missionFile
2023-09-23 14:05:31 +00:00
];
2023-10-16 19:35:01 +00:00
//diag_log format["_addMissionToQue (55): _missions = %1",_missions];
2023-09-23 14:05:31 +00:00
GMS_missionData pushBack _missions;