Sorted issues with static missions

Removed most debugging code.
Static missions randomly selected from a list of available missions.
See changelog for details.
This commit is contained in:
Ghostrider [GRG] 2023-10-16 15:35:01 -04:00
parent 2a7304960c
commit 22a6fc572a
14 changed files with 185 additions and 140 deletions

View File

@ -18,7 +18,8 @@ private "_markers";
"_markerColor", "_markerColor",
"_markerType", // Use either the name of the icon or "ELLIPSE" or "RECTANGLE" where non-icon markers are used "_markerType", // Use either the name of the icon or "ELLIPSE" or "RECTANGLE" where non-icon markers are used
["_markerSize",[0,0]], ["_markerSize",[0,0]],
["_markerBrush","GRID"] ["_markerBrush","GRID"],
["_showMarkers",true]
]; ];
if (GMS_debugLevel > 3) then if (GMS_debugLevel > 3) then
@ -41,22 +42,28 @@ if (GMS_debugLevel > 3) then
if (toUpper(_markerType) in ["ELLIPSE","RECTANGLE"]) then // not an Icon .... if (toUpper(_markerType) in ["ELLIPSE","RECTANGLE"]) then // not an Icon ....
{ {
private _m = createMarker [GMS_missionMarkerRootName + _markerName,_markerPos]; private _m = createMarker [GMS_missionMarkerRootName + _markerName,_markerPos];
_m setMarkerShape _markerType; If (_showMarkers) then {
_m setMarkerColor _markerColor; _m setMarkerShape _markerType;
_m setMarkerBrush _markerBrush; _m setMarkerColor _markerColor;
_m setMarkerSize _markerSize; _m setMarkerBrush _markerBrush;
_m setMarkerSize _markerSize;
};
private _m2 = createMarker [GMS_missionMarkerRootName + _markerName + "label", _markerPos]; private _m2 = createMarker [GMS_missionMarkerRootName + _markerName + "label", _markerPos];
_m2 setMarkerType "loc_destroy"; if (_showMarkers) then {
_m2 setMarkerColor "ColorWhite"; _m2 setMarkerType "loc_destroy";
_m2 setMarkerText _markerLabel; _m2 setMarkerColor "ColorWhite";
_m2 setMarkerText _markerLabel;
};
_markers = [_m,_m2]; _markers = [_m,_m2];
//diag_log format["_fnc_createMarkers: case of ELLIPSE/RECTANGLE: _markers = %1",_markers]; //diag_log format["_fnc_createMarkers: case of ELLIPSE/RECTANGLE: _markers = %1",_markers];
} else { } else {
private _m = ""; private _m = "";
private _m2 = createMarker [GMS_missionMarkerRootName + _markerName + "label", _markerPos]; private _m2 = createMarker [GMS_missionMarkerRootName + _markerName + "label", _markerPos];
_m2 setMarkerType _markerType; if (_showMarkers) then {
_m2 setMarkerColor _markerColor; _m2 setMarkerType _markerType;
_m2 setMarkerText _markerLabel; _m2 setMarkerColor _markerColor;
_m2 setMarkerText _markerLabel;
};
_markers = [_m,_m2]; _markers = [_m,_m2];
//diag_log format["_fnc_createMarkers: case of ICON: _markers = %1",_markers]; //diag_log format["_fnc_createMarkers: case of ICON: _markers = %1",_markers];
}; };

View File

@ -43,8 +43,9 @@ GMS_spawnHelisPass = 0;
//GMS_aiKilled = false; //GMS_aiKilled = false;
GMS_triggered = false; GMS_triggered = false;
GMS_revealMode = "detailed"; //""basic" /*group or vehicle level reveals*/,detailed /*unit by unit reveals*/"; GMS_revealMode = "detailed"; //""basic" /*group or vehicle level reveals*/,detailed /*unit by unit reveals*/";
GMS_dynamicMissionsSpawned = 0; GMS_MissionsSpawned = 0;
GMS_missionData = []; GMS_missionData = [];
GMS_initializedMissionsList = []; GMS_initializedMissionsList = [];
GMS_landVehiclePatrols = []; GMS_landVehiclePatrols = [];
GMS_aircraftPatrols = []; GMS_aircraftPatrols = [];

View File

@ -26,7 +26,9 @@ private ["_abort","_crates","_aiGroup","_objects","_groupPatrolRadius","_mission
"_chanceMissionSpawned", "_chanceMissionSpawned",
"_rewardVehicles", "_rewardVehicles",
// New private Variables from 10-15-23 // New private Variables from 10-15-23
"_timeoutMsg" "_timeoutMsg",
"_missionLandscapeMode",
"_showMarker"
]; ];
params["_markerName",["_aiDifficultyLevel","Red"]]; params["_markerName",["_aiDifficultyLevel","Red"]];
@ -92,6 +94,7 @@ if (isNil "_missionemplacedweapons") then {_missionemplacedweapons = []};
// Allow for and capture any custom difficult setting in the mission // Allow for and capture any custom difficult setting in the mission
if !(isNil "_difficulty") then {_aiDifficultyLevel = _difficulty}; if !(isNil "_difficulty") then {_aiDifficultyLevel = _difficulty};
if (isNil "_timeoutMsg") then {_timeoutMsg = ""}; if (isNil "_timeoutMsg") then {_timeoutMsg = ""};
if (isNil "_showMarker") then {_showMarker = true};
_markerType params["_markerType",["_markersize",[250,250]],["_markerBrush","GRID"]]; _markerType params["_markerType",["_markersize",[250,250]],["_markerBrush","GRID"]];
private _paraSkill = _aiDifficultyLevel; private _paraSkill = _aiDifficultyLevel;
@ -100,12 +103,12 @@ private _paraSkill = _aiDifficultyLevel;
if !(_spawnCratesTiming in GMS_validLootSpawnTimings) then if !(_spawnCratesTiming in GMS_validLootSpawnTimings) then
{ {
[format['Invalid crate spawn timing %1 found in mission %2 :: default value atMissionSpawnGround used',_spawnCratesTiming,_markerMissionName],"<WARNING>"] call GMS_fnc_log; [format['Invalid crate spawn timing %1 found in mission %2 :: default value atMissionSpawnGround used',_spawnCratesTiming,_markerMissionName],"<WARNING>"] call GMS_fnc_log;
_spawnCratesTiming = atMissionSpawnGround; _spawnCratesTiming = "atMissionSpawnGround";
}; };
if !(_loadCratesTiming in GMS_validLootLoadTimings) then if !(_loadCratesTiming in GMS_validLootLoadTimings) then
{ {
[format['Invalid crate loading timing %1 found in mission %2 :: default atMissionSpawn value used',_loadCratesTiming,_markerMissionName],"<WARNING>"] call GMS_fnc_log; [format['Invalid crate loading timing %1 found in mission %2 :: default atMissionSpawn value used',_loadCratesTiming,_markerMissionName],"<WARNING>"] call GMS_fnc_log;
_loadCratesTiming = atMissionSpawn; _loadCratesTiming = "atMissionSpawn";
}; };
if !(_endCondition in GMS_validEndStates) then if !(_endCondition in GMS_validEndStates) then
{ {
@ -119,7 +122,8 @@ private _markerConfigs = [
_markerType, _markerType,
_markerColor, _markerColor,
_markerSize, _markerSize,
_markerBrush _markerBrush,
_showMarker
]; ];
private _paraConfigs = [ private _paraConfigs = [

View File

@ -12,7 +12,7 @@ params[["_missionList",[]],["_path",""],["_marker",""],["_difficulty","Red"],["_
//diag_log format["_addMissionToQue: _this = %1",_this]; //diag_log format["_addMissionToQue: _this = %1",_this];
//{ //{
//diag_log format["_addMissionToQue: _this %1 = %2",_forEachIndex, _this select _forEachIndex]; // diag_log format["_addMissionToQue: _this %1 = %2",_forEachIndex, _this select _forEachIndex];
//} forEach _this; //} forEach _this;
private "_waitTime"; private "_waitTime";
@ -22,13 +22,13 @@ if (_isStatic) then {
_waitTime = diag_tickTime + (_tMin) + random((_tMax) - (_tMin)); _waitTime = diag_tickTime + (_tMin) + random((_tMax) - (_tMin));
}; };
diag_log format["_addMissionToQue: _waitTime = %1",_waitTime]; //diag_log format["_addMissionToQue: _waitTime = %1",_waitTime];
private _missionsData = []; // Parameters definine each of the missions for this difficulty are stored as arrays here. private _missionsData = []; // Parameters definine each of the missions for this difficulty are stored as arrays here.
{ {
private _missionFile = format["\GMS\Missions\%1\%2.sqf",_path,_x]; private _missionFile = format["\GMS\Missions\%1\%2.sqf",_path,_x];
diag_log format["_addMissionToQue: _missionFile = %1",_missionFile]; //diag_log format["_addMissionToQue: _missionFile = %1",_missionFile];
private _missionCode = compileFinal preprocessFileLinenumbers _missionFile;//return all of the values that define how the mission is spawned as an array of values 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 if !(isNil "_missionCode") then
{ {
@ -36,10 +36,10 @@ private _missionsData = []; // Parameters definine each of the missions for this
if !(isNil "_data") then if !(isNil "_data") then
{ {
_missionsData pushBack _data; _missionsData pushBack _data;
diag_log format["_addMissionToQue: _data = %1",_data]; //diag_log format["_addMissionToQue: _data = %1",_data];
}; };
} else { } else {
diag_log format["bad path\mission combination %1",_missionFile]; //diag_log format["bad path\mission combination %1",_missionFile];
}; };
} forEach _missionList; } forEach _missionList;
@ -56,7 +56,7 @@ private _missions = [
_missionsData, // Array of data about individual missions that could be spawned. The data table for each mission is defined in _missionSpawner _missionsData, // Array of data about individual missions that could be spawned. The data table for each mission is defined in _missionSpawner
_isStatic _isStatic
]; ];
diag_log format["_addMissionToQue (55): _missions = %1",_missions]; //diag_log format["_addMissionToQue (55): _missions = %1",_missions];
GMS_missionData pushBack _missions; GMS_missionData pushBack _missions;

View File

@ -22,25 +22,25 @@ params[
"_isStatic" "_isStatic"
]; ];
// _missionConfigs is configured as: // _missionConfigs is configured as:
/* /*
params [ params [
_aiDifficultyLevel, // index 0 _aiDifficultyLevel, // index 0
_markerConfigs, // index 1 _markerConfigs, // index 1
_endCondition, // index 2 _endCondition, // index 2
_isscubamission, // index 3 _isscubamission, // index 3
_missionLootConfigs, // index 4 _missionLootConfigs, // index 4
_aiConfigs, // index 5 _aiConfigs, // index 5
_missionMessages, // index 6 _missionMessages, // index 6
_paraConfigs, // index 7 _paraConfigs, // index 7
_defaultMissionLocations, // index 8 _defaultMissionLocations, // index 8
_maxMissionRespawns, // index 9 _maxMissionRespawns, // index 9
_timesSpawned, // index 10 _timesSpawned, // index 10
_chanceMissionSpawned, // index 11 _chanceMissionSpawned, // index 11
_isSpawned, // index 12 _isSpawned, // index 12
_spawnedAt // index 13 _spawnedAt // index 13
]; ];
*/ */
_missionConfigs params [ _missionConfigs params [
"_difficulty", // index 0 "_difficulty", // index 0
@ -59,11 +59,28 @@ params[
"_spawnedAt" // index 13 "_spawnedAt" // index 13
]; ];
#define timesSpawnedIndex 11
//diag_log format["_fnc_initializeMission _chanceMissionRespawned = %1", _chanceMissionSpawned];
// do not initialize if the odds of spawning are not favorable. // do not initialize if the odds of spawning are not favorable.
if (random(1) > _chanceMissionSpawned) exitWith {-1}; if (random(1) > _chanceMissionSpawned) exitWith {
diag_log format["_initializeMission (27): returning value of -1"];
-1
};
// If the mission has already been spawned the max number of times, pass back a code indicating that.
if (!(_maxMissionRespawns == -1) && (_timesSpawned > _maxMissionRespawns)) exitWith {
diag_log format["_initializeMission (32): returning value of -2"];
-2
};
// If the mission has not been spawned, but is a static mission and could be spawned if it met the test for chance of a spawn, pass back a code indicating that.
if (random(1) > _chanceMissionSpawned && (_isStatic) && (_timesSpawned == 0)) exitWith {
diag_log format["_initializeMission (37): returning value of 2"];
2
};
// If the mission is a static mission and it has been spawned but not cleared then pass back a code indicating that
if (_isStatic && _isSpawned) exitWith {
diag_log format["_initializeMission (42): returning value of 3"];
3
};
#define timesSpawnedIndex 11
_markerConfigs params[ _markerConfigs params[
"_markerName", // The unique text identifier for the marker "_markerName", // The unique text identifier for the marker
@ -71,14 +88,12 @@ _markerConfigs params[
"_markerType", "_markerType",
"_markerColor", "_markerColor",
"_markerSize", "_markerSize",
"_markerBrush" "_markerBrush",
"_showMarkers"
]; ];
//[format["_initializeMission (39): _markerName %1 | _key %2 | _missionCount %3 | _maxMissionRespawns %4 | _timesSpawned %5",_markerName,_key,_missionCount,_maxMissionRespawns,_timesSpawned]] call GMS_fnc_log; //[format["_initializeMission (39): _markerName %1 | _key %2 | _missionCount %3 | _maxMissionRespawns %4 | _timesSpawned %5",_markerName,_key,_missionCount,_maxMissionRespawns,_timesSpawned]] call GMS_fnc_log;
// If the mission is a static mission and it has been spawned but not cleared then pass back a code indicating that
if (_isStatic && _isSpawned) exitWith {private _initialized = 3; _initialized};
private _initialized = 0; private _initialized = 0;
/* /*
@ -110,7 +125,7 @@ if (_coords isEqualTo [] || {_coords isEqualTo [0,0,0]}) exitWith
GMS_ActiveMissionCoords pushback _coords; GMS_ActiveMissionCoords pushback _coords;
GMS_missionsRunning = GMS_missionsRunning + 1; GMS_missionsRunning = GMS_missionsRunning + 1;
//[format["_initializeMission (70): _coords = %1 | GMS_missionsRunning = %2",_coords,GMS_missionsRunning]] call GMS_fnc_log; //[format["_initializeMission (118): _coords = %1 | GMS_missionsRunning = %2",_coords,GMS_missionsRunning]] call GMS_fnc_log;
private _markers = []; private _markers = [];
@ -142,7 +157,7 @@ if !(GMS_preciseMapMarkers) then
private _markerError = false; private _markerError = false;
if !(toLowerANSI (_markerType) in ["ellipse","rectangle"] || {isClass(configFile >> "CfgMarkers" >> _markerType)} ) then if !(toLowerANSI (_markerType) in ["ellipse","rectangle"] || {isClass(configFile >> "CfgMarkers" >> _markerType)} ) then
{ {
//[format["_markerType set to 'ELLIPSE': Illegal marker type %1 used for mission %2 of difficulty %3",_markerType,_markerMissionName,_difficulty],"warning"] call GMS_fnc_log; [format["_markerType set to 'ELLIPSE': Illegal marker type %1 used for mission %2 of difficulty %3",_markerType,_markerMissionName,_difficulty],"warning"] call GMS_fnc_log;
_markerType = "ELLIPSE"; _markerType = "ELLIPSE";
_markerSize = [200,200]; _markerSize = [200,200];
_markerBrush = "GRID"; _markerBrush = "GRID";
@ -151,7 +166,7 @@ if !(toLowerANSI (_markerType) in ["ellipse","rectangle"] || {isClass(configFile
if !(isClass(configFile >> "CfgMarkerColors" >> _markerColor)) then if !(isClass(configFile >> "CfgMarkerColors" >> _markerColor)) then
{ {
//[format["_markerColor set to 'default': Illegal color %1 used for mission %2 of difficulty %3",_markerColor,_markerMissionName,_difficulty],"warning"] call GMS_fnc_log; [format["_markerColor set to 'default': Illegal color %1 used for mission %2 of difficulty %3",_markerColor,_markerMissionName,_difficulty],"warning"] call GMS_fnc_log;
_markerColor = "DEFAULT"; _markerColor = "DEFAULT";
_markerError = true; _markerError = true;
}; };
@ -166,9 +181,11 @@ private _markers = [
_markerColor, _markerColor,
_markerType, _markerType,
_markerSize, _markerSize,
_markerBrush] call GMS_fnc_createMissionMarkers; _markerBrush,
_showMarkers
] call GMS_fnc_createMissionMarkers;
if (GMS_debugLevel >= 0) then {[format["_initializeMission (130): _marker = %1 | _markerMissionName = %2 | _difficulty = %3",_markers,_markerMissionName,_difficulty]] call GMS_fnc_log}; //if (GMS_debugLevel >= 0) then {[format["_initializeMission (130): _marker = %1 | _markerMissionName = %2 | _difficulty = %3",_markers,_markerMissionName,_difficulty]] call GMS_fnc_log};
/* /*
Send a message to players. Send a message to players.
@ -205,6 +222,7 @@ private _missionData = [
lootVehicles, // index 8 lootVehicles, // index 8
_markers // index 9 _markers // index 9
]; ];
#define spawnPara -1 #define spawnPara -1
GMS_initializedMissionsList pushBack [_key, missionTimeoutAt, triggered, _missionData, _missionConfigs, spawnPara,_isStatic]; GMS_initializedMissionsList pushBack [_key, missionTimeoutAt, triggered, _missionData, _missionConfigs, spawnPara,_isStatic];
//[format["_initializeMission (163): count GMS_initializedMissionsList = %1",count GMS_initializedMissionsList]] call GMS_fnc_log; //[format["_initializeMission (163): count GMS_initializedMissionsList = %1",count GMS_initializedMissionsList]] call GMS_fnc_log;

View File

@ -229,7 +229,7 @@ for "_i" from 1 to (count _missionsList) do
"_missionLootVehicles" "_missionLootVehicles"
]; ];
if (GMS_debugLevel > 0) then {[format["_monitorSpawnedMissions(234): _exception = %1 | _spawnedAt = %2",_exception,_spawnedAt]] call GMS_fnc_log}; //if (GMS_debugLevel > 0) then {[format["_monitorSpawnedMissions(234): _exception = %1 | _spawnedAt = %2",_exception,_spawnedAt]] call GMS_fnc_log};
switch (_exception) do switch (_exception) do
{ {
case 1: { // Normal Mission End case 1: { // Normal Mission End

View File

@ -358,7 +358,7 @@ if (_spawnCratesTiming in ["atMissionSpawnGround","atMissionSpawnAir"]) then
if (_loadCratesTiming isEqualTo "atMissionSpawn") then if (_loadCratesTiming isEqualTo "atMissionSpawn") then
{ {
private _crateMoney =(missionNamespace getVariable[format["GMS_crateMoney%1",_difficulty],GMS_rewardsOrange]); private _crateMoney =(missionNamespace getVariable[format["GMS_crateMoney%1",_difficulty],GMS_rewardsOrange]);
diag_log format["_spawnMissionAssets(395): _crateMoney = %1",_crateMoney]; //diag_log format["_spawnMissionAssets(395): _crateMoney = %1",_crateMoney];
{ {
[_x,_difficulty,_crateMoney] call GMSCore_fnc_setMoney; [_x,_difficulty,_crateMoney] call GMSCore_fnc_setMoney;
} forEach _crates; } forEach _crates;

View File

@ -84,12 +84,12 @@ private _units = [];
] call GMSCore_fnc_initializeWaypointsAreaPatrol; ] call GMSCore_fnc_initializeWaypointsAreaPatrol;
*/ */
_helis pushBack _aircraft; _helis pushBack _aircraft;
if (GMS_debugLevel > 0) then {[format["_spawnMissionHelis: _heli %1 spawned with pilot %2 and crew %2",typeOf _aircraft, currentPilot _aircraft, _crewGroup]] call GMS_fnc_log}; //if (GMS_debugLevel > 0) then {[format["_spawnMissionHelis: _heli %1 spawned with pilot %2 and crew %2",typeOf _aircraft, currentPilot _aircraft, _crewGroup]] call GMS_fnc_log};
} else { } else {
[format["GMS_fnc_spawnMissionHelis: Invalid classname %1 used in _airPatrols", _heli],"warning"] call GMS_fnc_log; [format["GMS_fnc_spawnMissionHelis: Invalid classname %1 used in _airPatrols", _heli],"warning"] call GMS_fnc_log;
}; };
} forEach _missionHelis; } forEach _missionHelis;
[format["GMS_fnc_spawnMissionHelis: count _units = %1 | count _helis = %2", count _units, count _helis]] call GMS_fnc_log; //[format["GMS_fnc_spawnMissionHelis: count _units = %1 | count _helis = %2", count _units, count _helis]] call GMS_fnc_log;
GMS_spawnHelisPass = GMS_spawnHelisPass + 1; GMS_spawnHelisPass = GMS_spawnHelisPass + 1;
[_helis,_units] [_helis,_units]

View File

@ -39,9 +39,9 @@ private _patrolsThisMission = +_missionPatrolVehicles;
{ {
//diag_log format["_spawnMissionVehiclePatrols(41): _x = %1",_x]; //diag_log format["_spawnMissionVehiclePatrols(41): _x = %1",_x];
_x params[["_vehName",""],["_pos",[]],["_dir",0]]; _x params[["_vehName",""],["_pos",[]],["_dir",0]];
diag_log format["_spawnMissionVehiclePatrols(43): _vehName = %1 | _pos = %2 | _dir = %3 | isClass _vehName = %4",_vehName,_pos,_dir, isClass(configFile >> "CfgVehicles" >> _vehName)]; //diag_log format["_spawnMissionVehiclePatrols(43): _vehName = %1 | _pos = %2 | _dir = %3 | isClass _vehName = %4",_vehName,_pos,_dir, isClass(configFile >> "CfgVehicles" >> _vehName)];
_pos = _coords vectorAdd _pos; // else {_pos = (_coords vectorAdd _pos) findEmptyPosition[0,50,_vehName]}; _pos = _coords vectorAdd _pos; // else {_pos = (_coords vectorAdd _pos) findEmptyPosition[0,50,_vehName]};
diag_log format["_spawnMissionVehiclePatrols(45): _pos updated to %1",_pos]; //diag_log format["_spawnMissionVehiclePatrols(45): _pos updated to %1",_pos];
if (isClass(configFile >> "CfgVehicles" >> _vehName)) then { if (isClass(configFile >> "CfgVehicles" >> _vehName)) then {
if !(_pos isEqualTo []) then { if !(_pos isEqualTo []) then {
@ -122,6 +122,6 @@ private _patrolsThisMission = +_missionPatrolVehicles;
} forEach _patrolsThisMission; } forEach _patrolsThisMission;
GMS_landVehiclePatrols append _vehicles; GMS_landVehiclePatrols append _vehicles;
GMS_monitoredVehicles append _vehicles; GMS_monitoredVehicles append _vehicles;
[format["GMS_fnc_spawnMissionVehiclePatrols: count _missionAI = %1 | count _vehicles = %2", count _missionAI, count _vehicles]] call GMS_fnc_log; //[format["GMS_fnc_spawnMissionVehiclePatrols: count _missionAI = %1 | count _vehicles = %2", count _missionAI, count _vehicles]] call GMS_fnc_log;
[_vehicles, _missionAI]; [_vehicles, _missionAI];

View File

@ -19,89 +19,100 @@ if (GMS_missionsRunning >= GMS_maxSpawnedMissions) exitWith
{ {
[format["_spawnNewMissions (18): GMS_maxSpawnedMissions of %1 Reached",GMS_maxSpawnedMissions]] call GMS_fnc_log; [format["_spawnNewMissions (18): GMS_maxSpawnedMissions of %1 Reached",GMS_maxSpawnedMissions]] call GMS_fnc_log;
}; };
//[format["_spawnNewMissions (18): time = %1 GMS_debugLevel = %2",diag_tickTime,GMS_debugLevel]] call GMS_fnc_log;
for "_i" from 1 to (count GMS_missionData) do
{ {
private _missionDescriptors = _x; if (_i > (count GMS_missionData)) exitWith {};
private _missionDescriptors = GMS_missionData deleteAt 0;
// _missionDescriptor is configures as follows: // _missionDescriptor is configures as follows:
/* /*
private _mission = [ private _mission = [
_key, _key, // We can search for this key or for _missionDescriptors if we need to delete this particular mission.
_difficulty, _difficulty,
_noMissions, // Max no missions of this category _noMissions, // Max no missions of this category
0, // Number active 0, // Number active
_tMin, // Used to calculate waittime in the future _tMin, // Used to calculate waittime in the future
_tMax, // as above _tMax, // as above
_waitTime, // time at which a mission should be spawned _waitTime, // time at which a mission should be spawned
_missionsData, // Array of data about individual missions that could be spawned. The data table for each mission is defined in _missionSpawner _missionsData, // Array of data about individual missions that could be spawned. The data table for each mission is defined in _missionSpawner
_isStatic _isStatic
]; ];
*/ */
_missionDescriptors params["_key","_difficulty","_maxMissions","_activeMissions","_tMin","_tMax","_waitTime","_missionsData","_isStatic"]; _missionDescriptors params["_key","_difficulty","_maxMissions","_activeMissions","_tMin","_tMax","_waitTime","_missionsData","_isStatic"];
/* // Just in case there are no missions to choose from for some reason.
{ // But this could happen if all of the available missions had reached their maximal number of respawns.
diag_log format["_spawnNewMission: _this %1 = %2",_forEachIndex, _x]; // Note that an element with an empty _missionsData array is not added back for future evaluation.
} forEach _missionDescriptors; if !(_missionsData isEqualTo []) then {
*/
//diag_log format["_spawnNewMission: _missionsData = %1",_missionsData];
if (_missionsData isEqualTo []) exitWith {-1};
if (_activeMissions < _maxMissions && {diag_tickTime > _waitTime && {GMS_missionsRunning < GMS_maxSpawnedMissions}}) then
{
// time to reset timers and spawn something.
private _missionSelected = selectRandom _missionsData;
// _missionSelected is configured as:
/* /*
params [ _activeMissions = the number of active missions allowed of this type which can be, for example, blue missions or static missions.
_aiDifficultyLevel, // index 0 _maxMissions = the maximum number of missions allowed of this type.
_markerConfigs, // index 1 _waitTime = at what time can the next mission be spawned.
_endCondition, // index 2
_isscubamission, // index 3
_missionLootConfigs, // index 4
_aiConfigs, // index 5
_missionMessages, // index 6
_paraConfigs, // index 8
_defaultMissionLocations, // index 9
_maxMissionRespawns, // index 10
_timesSpawned, // index 11
_chanceMissionSpawned, // index 12
_isSpawned, // index 13
_spawnedAt // index 14
];
*/ */
/*{ if (_activeMissions < _maxMissions && {diag_tickTime > _waitTime && {GMS_missionsRunning < GMS_maxSpawnedMissions}}) then
diag_log format["_spawnNewMission:_missionSelected: _this %1 = %2",_forEachIndex,_x]; {
} forEach _missionSelected; // time to reset timers and spawn something.
*/ private _missionSelected = selectRandom _missionsData;
/* // _missionSelected is configured as:
params[ // for GMS_fnc_initialiZeMission are /*
"_key", // This key can be used to seach the list of available mission types to update that list when a mission is completed or times out params [
"_missionConfigs", // Selfevident but this is an array with all configs for the mission _aiDifficultyLevel, // index 0
"_missionCount", // The number of missions run thus far which is used to unsure each marker has a unique name _markerConfigs, // index 1
"_isStatic" _endCondition, // index 2
]; _isscubamission, // index 3
*/ _missionLootConfigs, // index 4
//diag_log format["_spawnNewMissions: _missionSelected = %1",_missionSelected]; _aiConfigs, // index 5
private _missionInitialized = [_key,_missionSelected,GMS_dynamicMissionsSpawned,_isStatic] call GMS_fnc_initializeMission; _missionMessages, // index 6
_paraConfigs, // index 8
if (_missionInitialized == 1) then { // This is a dynamic mission s see if we can spawn another instance of this categore (blue, red, green, orange) _defaultMissionLocations, // index 9
GMS_dynamicMissionsSpawned = GMS_dynamicMissionsSpawned + 1; _maxMissionRespawns, // index 10
#define waitTime 6 _timesSpawned, // index 11
#define noActive 3 _chanceMissionSpawned, // index 12
private _wt = diag_tickTime + _tmin + (random(_tMax - _tMin)); _isSpawned, // index 13
_missionDescriptors set[waitTime, _wt]; _spawnedAt // index 14
_missionDescriptors set[noActive, _activeMissions + 1]; ];
} else { */
if (_missionInitialized == -1) then // failed the test about chance of spawning private _missionInitialized = [_key,_missionSelected,GMS_MissionsSpawned,_isStatic] call GMS_fnc_initializeMission;
//[format["_spawnNewMissions (78) GMS_fnc_initializeMission returned %1",_missionInitialized]] call GMS_fnc_log;
switch (_missionInitialized) do
{ {
#define waitTime 6 case -2: {
private _wt = diag_tickTime + _tmin + (random(_tMax - _tMin)); // Handle the case in which a mission has been spawned _maxmissionRespawns
_missionDescriptors set[waitTime, _wt]; [format["_spawnNewMission (82): count _missionsData before deletion = %1", count _missionsData]] call GMS_fnc_log;
private _posn = _missionsData findIf {(_x select 0) isEqualTo _key};
_missionsData deleteAt _posn;
[format["_spawnNewMission (85): count _missionsData after deletion = %1", count _missionsData]] call GMS_fnc_log;
#define missionsData 7
_missionDescriptors set [missionsData, _missionsData];
};
case -1: {
#define waitTime 6
private _wt = diag_tickTime + _tmin + (random(_tMax - _tMin));
_missionDescriptors set[waitTime, _wt];
};
case 1: {
GMS_MissionsSpawned = GMS_MissionsSpawned + 1;
#define waitTime 6
#define noActive 3
private _wt = diag_tickTime + _tmin + (random(_tMax - _tMin));
_missionDescriptors set[waitTime, _wt];
_missionDescriptors set[noActive, _activeMissions + 1];
};
case 2: { // A special case for static missions that have never been spawned that did not pass the test for chance of a spawn. Here we set waitTime to 60 sec.
#define waitTime 6
private _wt = diag_tickTime + 60;
_missionDescriptors set[waitTime, _wt];
};
case 3: {
// Nothing to do here at this time.
};
}; };
}; };
GMS_missionData pushBack _missionDescriptors;
}; };
} forEach GMS_missionData; };
private _exitcode = 1; private _exitcode = 1;
_exitCode; _exitCode;

View File

@ -203,10 +203,14 @@ if (GMS_enableStaticMissions > 0 && !(_missionLIstStatics isEqualTo [])) then //
private _isStatic = true; private _isStatic = true;
private _numberStatics = count _missionListStatics; private _numberStatics = count _missionListStatics;
{ {
if ((count _staticsToSpawn) > (count _missionLIstStatics)) exitWith {}; [format["_init (206): _missionListStatics %1 = %2",_forEachIndex, _x]] call GMS_fnc_log;
private _mission = selectRandom _missionLIstStatics; } forEach _missionListStatics;
while {(count _staticsToSpawn) < (count _missionListStatics) && ((count _staticsToSpawn) < (GMS_enableStaticMissions))} do
{
private _mission = selectRandom _missionListStatics;
_staticsToSpawn pushBackUnique _mission; _staticsToSpawn pushBackUnique _mission;
} forEach _missionLIstStatics; [format["GMS_fnc_init (209): _mission = %1 | count _staticsToSpawn = %2",_mission, count _staticsToSpawn]] call GMS_fnc_log;
};
/* /*
params[ params[
["_missionList",[]], ["_missionList",[]],
@ -218,7 +222,7 @@ if (GMS_enableStaticMissions > 0 && !(_missionLIstStatics isEqualTo [])) then //
["_noMissions",1], ["_noMissions",1],
["_isStatic",false]]; ["_isStatic",false]];
*/ */
//diag_log format["_init: count _staticsToSpawn = %1 | GMS_enableStaticMissions = %2:",count _staticsToSpawn,GMS_enableStaticMissions]; diag_log format["_init: count _staticsToSpawn = %1 | GMS_enableStaticMissions = %2:",count _staticsToSpawn,GMS_enableStaticMissions];
[_staticsToSpawn,_pathStatics,"StaticsMarker","orange",GMS_TMin_Statics,GMS_TMax_Statics,GMS_enableStaticMissions,_isStatic] call GMS_fnc_addMissionToQue; [_staticsToSpawn,_pathStatics,"StaticsMarker","orange",GMS_TMin_Statics,GMS_TMax_Statics,GMS_enableStaticMissions,_isStatic] call GMS_fnc_addMissionToQue;
}; };

View File

@ -17,7 +17,7 @@
changing any of these variables may break the mission system changing any of these variables may break the mission system
*/ */
GMS_locationBlackList = []; // Do not touch ... GMS_locationBlackList = []; // Do not touch ...
GMS_debugLevel = 3; // should be set to 0 ... GMS_debugLevel = 0; // should be set to 0 ...
[format["Loading configurations for Non-militarized servers"]] call GMS_fnc_log; [format["Loading configurations for Non-militarized servers"]] call GMS_fnc_log;
/* /*
@ -342,7 +342,7 @@ switch (GMSCore_modType) do
GMS_enableRedMissions = 2; GMS_enableRedMissions = 2;
GMS_enableBlueMissions = 1; GMS_enableBlueMissions = 1;
GMS_numberUnderwaterDynamicMissions = 0; // Values from -1 (no UMS) to N (N Underwater missions will be spawned; static UMS units and subs will be spawned. GMS_numberUnderwaterDynamicMissions = 0; // Values from -1 (no UMS) to N (N Underwater missions will be spawned; static UMS units and subs will be spawned.
GMS_enableStaticMissions = 3; GMS_enableStaticMissions = 2;
#ifdef GRGserver #ifdef GRGserver
GMS_enableHunterMissions = 1; GMS_enableHunterMissions = 1;

View File

@ -152,7 +152,7 @@ if (GMS_debugLevel > 0) then {
GMS_enableRedMissions = 0; // 10-2-2023 Tested with mission list= "fuelDepot", "junkyardWilly", "TraderBoss", "carThieves", "Ammunition_depot", "IDAP", "Outpost", "Service_Point" GMS_enableRedMissions = 0; // 10-2-2023 Tested with mission list= "fuelDepot", "junkyardWilly", "TraderBoss", "carThieves", "Ammunition_depot", "IDAP", "Outpost", "Service_Point"
GMS_enableBlueMissions = 0; // 10-2-2023 Tested with mission list= "sniperBase", "survivalSupplies", "Service_point", and "default" GMS_enableBlueMissions = 0; // 10-2-2023 Tested with mission list= "sniperBase", "survivalSupplies", "Service_point", and "default"
GMS_numberUnderwaterDynamicMissions = 0; GMS_numberUnderwaterDynamicMissions = 0;
GMS_enableHunterMissions = 0; GMS_enableHunterMissions = 1;
GMS_enableScoutsMissions = 1; GMS_enableScoutsMissions = 1;
GMS_enableStaticMissions = 1; GMS_enableStaticMissions = 1;
GMS_maxCrashSites = 0; GMS_maxCrashSites = 0;

View File

@ -12,9 +12,9 @@
*/ */
class GMSBuild { class GMSBuild {
Version = "7.166"; Version = "7.17";
Build = "271"; Build = "272";
Date = "10-15-2023"; Date = "10-16-2023";
}; };
class CfgPatches { class CfgPatches {