diff --git a/@GMS/addons/GMS.pbo b/@GMS/addons/GMS.pbo new file mode 100644 index 0000000..675704c Binary files /dev/null and b/@GMS/addons/GMS.pbo differ diff --git a/@GMS/addons/GMS/Compiles/Functions/fn_mainThread.sqf b/@GMS/addons/GMS/Compiles/Functions/fn_mainThread.sqf index e441f8c..5eef194 100644 --- a/@GMS/addons/GMS/Compiles/Functions/fn_mainThread.sqf +++ b/@GMS/addons/GMS/Compiles/Functions/fn_mainThread.sqf @@ -24,7 +24,6 @@ while {true} do if (diag_tickTime > _timer2sec) then { - [] spawn GMS_fnc_monitorSpawnedMissions; if (GMS_showCountAliveAI) then { { @@ -38,6 +37,8 @@ while {true} do { _timer5sec = diag_tickTime + 5; if (GMS_simulationManager isEqualTo GMS_useBlckeaglsSimulationManagement) then {[] call GMS_fnc_simulationMonitor}; + [] spawn GMS_fnc_monitorSpawnedMissions; + [] call GMS_fnc_scanForPlayersNearVehicles; [] call GMS_fnc_vehicleMonitor; #ifdef GRGserver [] call GMS_fnc_broadcastServerFPS; @@ -46,9 +47,8 @@ while {true} do if (diag_tickTime > _timer10Sec) then { _timer10Sec = diag_tickTime + 10; - [] call GMS_fnc_scanForPlayersNearVehicles; [] call GMS_fnc_spawnNewMissions; - [] spawn GMS_fnc_monitorInitializedMissions; + [] call GMS_fnc_monitorInitializedMissions; }; if ((diag_tickTime > _timer1min)) then diff --git a/@GMS/addons/GMS/Compiles/GMS_variables.sqf b/@GMS/addons/GMS/Compiles/GMS_variables.sqf index 2958c82..686c9b3 100644 --- a/@GMS/addons/GMS/Compiles/GMS_variables.sqf +++ b/@GMS/addons/GMS/Compiles/GMS_variables.sqf @@ -37,6 +37,11 @@ DMS_missionMarkerRootName = "DMS_MissionMarker"; GMS_missionLabelMarkers = []; GMS_mainThreadUpdateInterval = 60; GMS_monitoring = false; +GMS_monitoringInitPass = 0; +GMS_spawnHelisPass = 0; +GMS_playerIsNear = false; +GMS_aiKilled = false; +GMS_triggered = false; GMS_revealMode = "detailed"; //""basic" /*group or vehicle level reveals*/,detailed /*unit by unit reveals*/"; GMS_dynamicMissionsSpawned = 0; GMS_missionData = []; diff --git a/@GMS/addons/GMS/Compiles/Missions/GMS_fnc_missionSpawner.sqf b/@GMS/addons/GMS/Compiles/Missions/GMS_fnc_missionSpawner.sqf index 9bb134e..b0cdf47 100644 --- a/@GMS/addons/GMS/Compiles/Missions/GMS_fnc_missionSpawner.sqf +++ b/@GMS/addons/GMS/Compiles/Missions/GMS_fnc_missionSpawner.sqf @@ -18,7 +18,10 @@ private ["_abort","_crates","_aiGroup","_objects","_groupPatrolRadius","_mission "_chanceHeliPatrol","_noPara","_chanceLoot","_heliCrew","_loadCratesTiming","_useMines","_GMS_AllMissionAI","_delayTime","_groupPatrolRadius","_simpleObjects", "_wait","_missionStartTime","_playerInRange","_missionTimedOut","_temp","_patrolVehicles","_vehToSpawn","_noChoppers","_chancePara","_paraSkill","_marker","_vehicleCrewCount", "_defaultMissionLocations","_garrisonedbuildings_buildingposnsystem","_garrisonedBuilding_ATLsystem", "_isScubaMission","_markerlabel","_missionLootBoxes","_airpatrols", - "_submarinePatrols","_scubaPatrols","_maxMissionRespawns"]; + "_submarinePatrols","_scubaPatrols","_maxMissionRespawns", + // New private variables + "_chanceMissionSpawned", + "_rewardVehicles "]; params["_markerName",["_aiDifficultyLevel","Red"]]; if (isNil "_markerLabel") then {_markerLabel = _markerMissionName}; @@ -68,7 +71,12 @@ if (isNil "_lootCrates") then {_lootCrates = GMS_crateTypes}; if (isNil "_lootCratePositions") then {_lootCratePositions = []}; if (isNil "_isScubaMission") then {_isScubaMission = false}; if (isNil "_missionLootBoxes") then {_missionLootBoxes = []}; + +// New in Sept 2023 - reward vehicles are spawned after a mission is cleared. +if (isNil "_rewardVehicles") then {_rewardVehicles = []}; + if (isNil "_defaultMissionLocations") then {_defaultMissionLocations = []}; +if (isNil "_chanceMissionSpawned") then {_chanceMissionSpawned = 100}; if (isNil "_maxMissionRespawns") then {_maxMissionRespawns = -1}; if (isNil "_simpleObjects") then {_simpleObjects = []}; if (isNil "_missionemplacedweapons") then @@ -77,19 +85,22 @@ if (isNil "_missionemplacedweapons") then diag_log format["[GMS] _missionSpawner: setting _missionemplacedweapons to its default value of %1",_missionemplacedweapons]; }; +// Allow for and capture any custom difficult setting in the mission +if !(isNil "_difficulty") then {_aiDifficultyLevel = _difficulty}; + _markerType params["_markerType",["_markersize",[250,250]],["_markerBrush","GRID"]]; private _paraSkill = _aiDifficultyLevel; if !(_spawnCratesTiming in GMS_validLootSpawnTimings) then { - [format['Invalid crate spawn timing %1 found in mission %2 :: default value "atMissionSpawnGround" used',_spawnCratesTiming,_markerMissionName],""] call GMS_fnc_log; - _spawnCratesTiming = "atMissionSpawnGround"; + [format['Invalid crate spawn timing %1 found in mission %2 :: default value atMissionSpawnGround used',_spawnCratesTiming,_markerMissionName],""] call GMS_fnc_log; + _spawnCratesTiming = atMissionSpawnGround; }; if !(_loadCratesTiming in GMS_validLootLoadTimings) then { - [format['Invalid crate loading timing %1 found in mission %2 :: default "atMissionSpawn" value used',_loadCratesTiming,_markerMissionName],""] call GMS_fnc_log; - _loadCratesTiming = "atMissionSpawn"; + [format['Invalid crate loading timing %1 found in mission %2 :: default atMissionSpawn value used',_loadCratesTiming,_markerMissionName],""] call GMS_fnc_log; + _loadCratesTiming = atMissionSpawn; }; if !(_endCondition in GMS_validEndStates) then { @@ -166,6 +177,7 @@ private _missionMessages = [ ]; private _timesSpawned = 0; +private _isSpawned = false; private _table = [ _aiDifficultyLevel, _markerConfigs, @@ -177,7 +189,8 @@ private _table = [ _paraConfigs, _defaultMissionLocations, _maxMissionRespawns, - _timesSpawned + _timesSpawned, + _isSpawned ]; //[format["_missionSpawner (182): _defaultMissionLocations %1 | _maxMissionRespawns %2 | _timesSpawned %3",_defaultMissionLocations,_maxMissionRespawns,_timesSpawned]] call GMS_fnc_log; _table diff --git a/@GMS/addons/GMS/Compiles/Missions/fn_addMIssionToQue.sqf b/@GMS/addons/GMS/Compiles/Missions/fn_addMIssionToQue.sqf index 6054483..8f689e6 100644 --- a/@GMS/addons/GMS/Compiles/Missions/fn_addMIssionToQue.sqf +++ b/@GMS/addons/GMS/Compiles/Missions/fn_addMIssionToQue.sqf @@ -6,25 +6,29 @@ By Ghostrider-GRG- Copyright 2016 - -------------------------- - License - -------------------------- - All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. - - http://creativecommons.org/licenses/by-nc-sa/4.0/ */ #include "\GMS\Compiles\Init\GMS_defines.hpp" -params["_missionList","_path","_marker","_difficulty","_tMin","_tMax",["_noMissions",1]]; -if (GMS_debugLevel >= 3) then +params[["_missionList",[]],["_path",""],["_marker",""],["_difficulty","Red"],["_tMin",60],["_tMax",120],["_noMissions",1],["_isStatic",false]]; +//diag_log format["_addMissionToQue: _this = %1",_this]; +/* { - { - diag_log format["_addMissionToQue: _this %1 = %2",_forEachIndex, _this select _forEachIndex]; - } forEach _this; + diag_log format["_addMissionToQue: _this %1 = %2",_forEachIndex, _this select _forEachIndex]; +} forEach _this; +*/ +private "_waitTime"; +if (_isStatic) then { + _waitTime = 60; +} else { + _waitTime = diag_tickTime + (_tMin) + random((_tMax) - (_tMin)); }; -private _waitTime = diag_tickTime + (_tMin) + random((_tMax) - (_tMin)); + +//diag_log format["_addMissionToQue: _waitTime = %1",_waitTime]; + + 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]; + //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 if !(isNil "_missionCode") then { @@ -32,12 +36,14 @@ private _missionsData = []; // Parameters definine each of the missions for this if !(isNil "_data") then { _missionsData pushBack _data; + //diag_log format["_addMissionToQue: _data = %1",_data]; }; } else { - diag_log format["bad path\mission combination %1",_missionFile]; + //diag_log format["bad path\mission combination %1",_missionFile]; }; } forEach _missionList; + private _key = round(random(10000)); private _missions = [ _key, @@ -47,9 +53,10 @@ private _missions = [ _tMin, // Used to calculate waittime in the future _tMax, // as above _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 ]; - +//diag_log format["_addMissionToQue (55): _missions = %1",_missions]; GMS_missionData pushBack _missions; diff --git a/@GMS/addons/GMS/Compiles/Missions/fn_initializeMission.sqf b/@GMS/addons/GMS/Compiles/Missions/fn_initializeMission.sqf index 5ad69f3..f0074c8 100644 --- a/@GMS/addons/GMS/Compiles/Missions/fn_initializeMission.sqf +++ b/@GMS/addons/GMS/Compiles/Missions/fn_initializeMission.sqf @@ -7,7 +7,7 @@ [_mrkr,_difficulty,_m] call GMS_fnc_initializeMission; Returns one of the following values: - 0 - the search for a position was unsuccessful - _coords == [] + 0 - this is a static mission that has been spawned and has not been completed 1 - the mission was successfully initialized at _coords != [0,0,0] 2 - the mission has been run the maximum allowed times. */ @@ -18,7 +18,8 @@ private ["_coords","_coordArray","_return"]; params[ "_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 "_missionConfigs", // Selfevident but this is an array with all configs for the mission - "_missionCount" // The number of missions run thus far which is used to unsure each marker has a unique name + "_missionCount", // The number of missions run thus far which is used to unsure each marker has a unique name + "_isStatic" ]; _missionConfigs params [ @@ -32,7 +33,8 @@ params[ "_paraConfigs", "_defaultMissionLocations", "_maxMissionRespawns", - "_timesSpawned" + "_timesSpawned", + "_isSpawned" ]; _markerConfigs params[ @@ -46,6 +48,9 @@ _markerConfigs params[ [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; /* @@ -99,7 +104,8 @@ if !(GMS_preciseMapMarkers) then _markerPos = [_coords,75] call GMS_fnc_randomPosition; }; -if (GMS_debugLevel >= 3) then +/* +if (GMS_debugLevel >=30) then { { diag_log format["_initializeMission (95) %1 = %2",_x,_markerConfigs select _forEachIndex]; @@ -110,6 +116,8 @@ if (GMS_debugLevel >= 3) then "_markerBrush" ]; }; +*/ + private _markerError = false; if !(toLowerANSI (_markerType) in ["ellipse","rectangle"] || {isClass(configFile >> "CfgMarkers" >> _markerType)} ) then { @@ -119,6 +127,7 @@ if !(toLowerANSI (_markerType) in ["ellipse","rectangle"] || {isClass(configFile _markerBrush = "GRID"; _markerError = true; }; + 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; @@ -164,13 +173,13 @@ private _missionData = [ hiddenObjects, crates, missionAI, - assetSpawned, + assetSpawned, /// Used for missions for which a hostage or target is spawned. missionVehicles, lootVehicles, _markers ]; private _spawnPara = -1; -GMS_initializedMissionsList pushBack [_key, missionTimeoutAt, triggered, _missionData, _missionConfigs, _spawnPara]; +GMS_initializedMissionsList pushBack [_key, missionTimeoutAt, triggered, _missionData, _missionConfigs, _spawnPara,_isSpawned,_isStatic]; //[format["_initializeMission (163): count GMS_initializedMissionsList = %1",count GMS_initializedMissionsList]] call GMS_fnc_log; _initialized = 1; _initialized \ No newline at end of file diff --git a/@GMS/addons/GMS/Compiles/Missions/fn_monitorInitializedMissions.sqf b/@GMS/addons/GMS/Compiles/Missions/fn_monitorInitializedMissions.sqf index 0750ae1..a64bffe 100644 --- a/@GMS/addons/GMS/Compiles/Missions/fn_monitorInitializedMissions.sqf +++ b/@GMS/addons/GMS/Compiles/Missions/fn_monitorInitializedMissions.sqf @@ -12,9 +12,9 @@ */ #include "\GMS\Compiles\Init\GMS_defines.hpp" -//GMS_activeMonitorThreads = GMS_activeMonitorThreads + 1; +//if (GMS_monitoring) exitWith {diag_log format["_monitorInitializedMissions: execution terminated for GMS_monitoring = true at %1",diag_tickTime]}; GMS_monitoring = true; - +GMS_monitoringInitPass = GMS_monitoringInitPass + 1; //[format["_monitorInitializedMissions (17): GMS_initializedMissionsList = %1", GMS_initializedMissionsList]] call GMS_fnc_log; private _missionsList = GMS_initializedMissionsList; @@ -31,7 +31,9 @@ for "_i" from 1 to (count _missionsList) do "_triggered", // 2 // integer - specifies if mission was triggered by a player or scripting such as debug setting "_missionData", // 4 // variable containing information specific to this instance of the mission such as location and objects "_missionConfigs", // 5 // Variables regarding the configuration of the dynamic mission - "_spawnPara" + "_spawnPara", + "_spawned", + "_isStatic" ]; #define triggered 2 @@ -40,6 +42,7 @@ for "_i" from 1 to (count _missionsList) do private _monitorAction = -2; + if (_triggered == 0) then { if ((_missionTimeoutAt > 0) && {diag_tickTime > _missionTimeoutAt}) then @@ -49,7 +52,9 @@ for "_i" from 1 to (count _missionsList) do } else { private _playerInRange = [missionCoords, GMS_TriggerDistance, false, true] call GMS_fnc_playerInRange; if (_playerInRange) then { - //diag_log format["_monitorInitializedMissions (41) Player in range criteria met at %1",diag_tickTime]; + //diag_log format["_monitorInitializedMissions (52) Player in range criteria met at %1 for _key %2",diag_tickTime,_key]; + //diag_log format["_monitorInitializedMissions(53) GMS_monitoring = %1 | GMS_monitoringInitPass = %2",GMS_monitoring,GMS_monitoringInitPass]; + //diag_log format["_monitorInitializedMissions(54) count of entries for _el = %1", {_x isEqualTo _el} count _missionsList]; _monitorAction = 0; } else { if (GMS_debugLevel >= 3) then @@ -65,13 +70,33 @@ for "_i" from 1 to (count _missionsList) do switch (_monitorAction) do { + // Nothing needs to be done case -2 : { _missionsList pushBack _el; }; + // Handle Timeout case -1: { - + /* + // List the full list of variables in _missionConfigs to aide in coding + + _missionConfigs params [ + "_difficulty", // index = 0 + "_markerConfigs", + "_endCondition", + "_isscubamission", + "_missionLootConfigs", + "_aiConfigs", + "_missionMessages", + "_paraConfigs", + "_defaultMissionLocations", + "_maxMissionRespawns", + "_timesSpawned", + "_isSpawned" // index = 11 + ]; + */ + _missionConfigs params[ "_difficulty", "_markerConfigs", @@ -79,8 +104,7 @@ for "_i" from 1 to (count _missionsList) do "_isscubamission", "_missionLootConfigs", "_aiConfigs", - "_missionMessages", - "_paraConfigs" + "_missionMessages" ]; _missionMessages params [ @@ -98,336 +122,20 @@ for "_i" from 1 to (count _missionsList) do ["_missionLootConfigs",[]], ["_isScuba",false], ["_endCode",-1] - */ + */ + _missionConfigs set[isSpawned,false]; [_key, _missionData, "", _missionData,_missionLootConfigs,_isscubamission,-1] call GMS_fnc_endMission; + _missionsList pushBack _el; }; // Handle mission waiting to be triggerd and player is within the range to trigger case 0: { - //waitUntil {!_spawningMission}; - //_spawningMission = true; // to prevent the script from trying to spawn multiple missions at the same time. - - #define noActive 2 - #define waitTime 5 - #define missionData 6 - - /* - _missionData = [ - _coords, - _mines, - _objects, - _hiddenObjects, - _crates, - _missionInfantry, - _assetSpawned, - _aiVehicles, - _lootVehicles, - _markers]; - */ - _missionData params [ - "_coords", - "_mines", - "_objects", - "_hiddenObjects", - "_crates", - "_missionInfantry", - "_assetSpawned", - "_aiVehicles", - "_lootVehicles", - "_markers" - ]; - _missionConfigs params[ - "_difficulty", - "_markerConfigs", - "_endCondition", - "_isscubamission", - "_missionLootConfigs", - "_aiConfigs", - "_missionMessages", - "_paraConfigs", - "_defaultMissionLocations" - ]; - _markers params[ - "_shapedMarker", - "_iconMarker" - ]; - _missionMessages params [ - "_assetKilledMsg", - "_endMsg", - "_startMsg" - ]; - _missionLootConfigs params [ - "_spawnCratesTiming", - "_loadCratesTiming", - "_crateLoot", - "_lootCounts", - "_missionLootBoxes", - "_missionLootVehicles" - ]; - _aiConfigs params [ - "_uniforms", - "_headgear", - "_vests", - "_backpacks", - "_weaponList", - "_sideArms", - "_missionLandscapeMode", - "_garrisonedBuildings_BuildingPosnSystem", - "_garrisonedBuilding_ATLsystem", - "_missionLandscape", - "_simpleObjects", - "_missionPatrolVehicles", - "_submarinePatrols", // Added Build 227 - "_submarinePatrolParameters", - "_airPatrols", - "_noVehiclePatrols", - "_vehicleCrewCount", - "_missionEmplacedWeapons", - "_noEmplacedWeapons", - "_useMines", - "_minNoAI", - "_maxNoAI", - "_noAIGroups", - "_missionGroups", - "_scubaPatrols", // Added Build 227 - "_scubaGroupParameters", - "_hostageConfig", - "_enemyLeaderConfig", - "_chanceHeliPatrol", - "_noChoppers", - "_missionHelis" - ]; - - + [_missionData,_missionConfigs,_spawnPara] spawn GMS_fnc_spawnMissionAssets; _el set[triggered,1]; - private["_temp"]; - if (GMS_SmokeAtMissions select 0) then // spawn a fire and smoke near the crate - { - _temp = [_coords,GMS_SmokeAtMissions select 1] call GMS_fnc_smokeAtCrates; - _objects append _temp; - //[format["_monitorInitializedMissions (181): added Smoke objects, _iconMarker %3 | count _objects = %1 | _objects = %2",count _objects, _objects,_iconMarker]] call GMS_fnc_log; - uiSleep delayTime; - }; - - if (_useMines) then - { - _temp = [_coords] call GMS_fnc_spawnMines; - _mines = _temp; - //[format["_monitorInitializedMissions (189): spawned mines for mission _iconMarker %3 | located at %1 | mines = %2",_coords,_mines,_iconMarker]] call GMS_fnc_log; - uiSleep delayTime; - }; - - if (_missionLandscapeMode isEqualTo "random") then - { - _temp = [_coords,_missionLandscape, 3, 15, 2] call GMS_fnc_spawnRandomLandscape; - //[format["_monitorInitializedMissions (196): spawned randomly place objects for _iconMarker %3 | at %1 | list of objects = %2",_coords,_temp select 0,_iconMarker]] call GMS_fnc_log; - } else { - _temp = [_coords, _missionLandscape] call GMS_fnc_spawnCompositionObjects; - //[format["_monitorInitializedMissions (199): precisly positioned objects for _iconMarker %3 | at %1 | list of objects = %2",_coords,_temp select 0,_iconMarker]] call GMS_fnc_log; - }; - _temp params["_obj","_hiddenObj"]; - _objects append _obj; - _hiddenObjects append _hiddenObj; - //[format["_monitorInitializedMissions (204): added landscape objects for _iconMarker %1 | count _objects = %2 | _objects = %3",_iconMarker,count _objects, _objects]] call GMS_fnc_log; - uiSleep delayTime; - - _temp = [_coords,_simpleObjects,true] call GMS_fnc_spawnSimpleObjects; - _objects append _temp; - //[format["_monitorInitializedMissions (209): added simple objects for _iconMarker %1 | count _objects = %2 | _objects = %3",_iconMarker,count _objects, _objects]] call GMS_fnc_log; - - _ai = [_coords, _minNoAI,_maxNoAI,_noAIGroups,_missionGroups,_difficulty,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms,_isScubaMission] call GMS_fnc_spawnMissionAI; - _missionInfantry append _ai; - //[format["_monitorInitializedMissions (213): spawned mission AI for _iconMarker %1 at %2 | with count _missionInfantry = %3 | with _missionInfantry = %4",_iconMarker,diag_tickTime,count _missionInfantry, _missionInfantry]] call GMS_fnc_log; - uiSleep delayTime; - - if (!(_scubaGroupParameters isEqualTo []) || {_scubaPatrols > 0}) then - { - _ai = [_coords, _minNoAI,_maxNoAI,_scubaPatrols,_scubaGroupParameters,_difficulty,GMS_UMS_uniforms,GMS_UMS_headgear,GMS_UMS_vests,_backpacks,GMS_UMS_weapons,_sideArms,true] call GMS_fnc_spawnMissionAI; - _missionInfantry append _ai; - uiSleep delayTime; - }; - - // TODO: 05/08/22 -> redo code to handle this - if !(_hostageConfig isEqualTo []) then - { - _temp = [_coords,_hostageConfig] call GMS_fnc_spawnHostage; - _assetSpawned = _temp select 0; - _objects pushBack (_temp select 1); // The building in which the asset was spawned. - uiSleep delayTime; - }; - - // TODO: 05/08/22 -> redo code to handle this - if !(_enemyLeaderConfig isEqualTo []) then - { - _temp = [_coords,_enemyLeaderConfig] call GMS_fnc_spawnLeader; - if (_temp isEqualTo grpNull) then {throw 1} else - { - _assetSpawned = _temp select 0; - _objects pushBack (_temp select 1); // The building in which the asset was spawned. - _missionInfantry pushBack _assetSpawned; - }; - uiSleep delayTime; - }; - - private _noChoppers = [_noChoppers] call GMSCore_fnc_getNumberFromRange; - //[format["_monitorInitializeMissions(246): _iconMarker %1 | _noChoppers = %2",_iconMarker,_noChoppers]] call GMS_fnc_log; - if ((_noChoppers > 0) && {random(1) < _chanceHeliPatrol}) then - { - _temp = [_coords,_noChoppers,_missionHelis,_difficulty,_uniforms,_headGear,_vests,_backpacks,_weaponList, _sideArms] call GMS_fnc_spawnMissionHelis; - _temp params["_helisSpawned","_unitsSpawned"]; - //[format["_monitorInitializeMissions (251): _iconMarker %1 | _helisSpawned = %2",_iconMarker,_helisSpawned]] call GMS_fnc_log; - - GMS_monitoredVehicles append _helisSpawned; - GMS_aircraftPatrols append _helisSpawned; // Used to find nearest heli ... - _aiVehicles append _helisSpawned; - _missionInfantry append _unitsSpawned; - uisleep delayTime; - }; - - // TODO: 05/08/22 -> redo code to handle this - if !(_garrisonedBuilding_ATLsystem isEqualTo []) then // Note that there is no error checking here for nulGroups - { - _temp = [_coords, _garrisonedBuilding_ATLsystem, _difficulty,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call GMS_fnc_garrisonBuilding_ATLsystem; - _temp params["_unitsSpawned","_staticsSpawned","_buildingsSpawned"]; - _objects append _buildingsSpawned; - //[format["_monitorInitializedMissions (264): added ATL Garrisons, _iconMarker %1 | count _objects = %2 | _objects = %3",_iconMarker,count _objects, _objects]] call GMS_fnc_log; - GMS_monitoredVehicles append _staticsSpawned; - _missionInfantry append _unitsSpawned; - uiSleep delayTime; - }; - - // TODO: 05/08/22 -> redo code to handle this - if !(_garrisonedBuildings_BuildingPosnSystem isEqualTo []) then - { - _temp = [_coords, _garrisonedBuildings_BuildingPosnSystem, _difficulty,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call GMS_fnc_garrisonBuilding_RelPosSystem; - _objects append (_temp select 1); - GMS_monitoredVehicles append (_temp select 2); - _missionInfantry append (units (_temp select 0)); - uiSleep delayTime; - }; - - private _userelativepos = true; - private _emplacedWeaponsThisMission = [_noEmplacedWeapons] call GMSCore_fnc_getNumberFromRange; - if (GMS_useStatic && {((_emplacedWeaponsThisMission > 0) || {!(_missionEmplacedWeapons isEqualTo [])} )} ) then - { - _temp = [_coords,_missionEmplacedWeapons,_userelativepos,_emplacedWeaponsThisMission,_difficulty,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call GMS_fnc_spawnEmplacedWeaponArray; - _temp params["_statics","_units"]; - _objects append _statics; - _missionInfantry append _units; - //[format["_monitorInitializedMissions (288): spawned emplaced weapons for _iconMarker %1 at %2 | with count _missionInfantry = %3 | with _statics = %4",_iconMarker,diag_tickTime,count _missionInfantry, _statics]]; - uisleep delayTime; - }; - - - if !(_missionLootVehicles isEqualTo []) then - { - _lootVehicles = [_coords,_missionLootVehicles,_spawnCratesTiming] call GMS_fnc_spawnMissionLootVehicles; - uiSleep delayTime; - }; - - private _noPatrols = [_noVehiclePatrols] call GMSCore_fnc_getNumberFromRange; - //[format["_monitorInitializedMissions (300): _iconMarker %1 | _noPatrols (vehicle) = %2",_iconMarker,_noPatrols]] call GMS_fnc_log; - if (GMS_useVehiclePatrols && {( (_noPatrols > 0) || {!(_missionPatrolVehicles isEqualTo [])} )} ) then - { - _temp = [_coords,_noPatrols,_difficulty,_missionPatrolVehicles,_userelativepos,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms,false,_vehicleCrewCount] call GMS_fnc_spawnMissionVehiclePatrols; - _temp params["_vehs","_units"]; - - _aiVehicles append _vehs; - _missionInfantry append _units; - //[format["_monitorInitializedMissions (307): spawned vehicle patrols for _shapedMarker %1 at %2 | with count _missionInfantry = %3 | with _vehs = %4 | _missionInfantry = %5",_shapedMarker,diag_tickTime,count _missionInfantry, _vehs, _missionInfantry]] call GMS_fnc_log; - uiSleep delayTime; - }; - - if (GMS_useVehiclePatrols && {((_submarinePatrols > 0) || {!(_submarinePatrolParameters isEqualTo [])} )} ) then - { - _temp = [_coords,_noPatrols,_difficulty,_submarinePatrolParameters,_userelativepos,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms,_isScubaMission,_vehicleCrewCount] call GMS_fnc_spawnMissionVehiclePatrols; - _temp params["_vehs","_units"]; - GMS_monitoredVehicles append _vehs; - GMS_landVehiclePatrols append _vehs; - _aiVehicles append _vehs; - _missionInfantry append _units; - uiSleep delayTime; - //[format["_monitorInitializedMissions: spawned sub patrols %1",_coords]] call GMS_fnc_log; - }; - - if (_spawnCratesTiming in ["atMissionSpawnGround","atMissionSpawnAir"]) then - { - if (_missionLootBoxes isEqualTo []) then - { - _crates = [_coords,[[selectRandom GMS_crateTypes,[1,1,0],_crateLoot,_lootCounts]], _loadCratesTiming, _spawnCratesTiming, "start", _difficulty] call GMS_fnc_spawnMissionCrates; - //[format["_monitorInitializedMissions (326): _shapedMarker %1 | standard locations for crates at %2 | _crates = %3",_shapedMarker,_coords,_crates]] call GMS_fnc_log; - } - else - { - _crates = [_coords,_missionLootBoxes,_loadCratesTiming, _spawnCratesTiming, "start", _difficulty] call GMS_fnc_spawnMissionCrates; - //[format["_monitorInitializedMissions (331): _iconMarker %1 | predefined locations for crates at %2 | _crates = %3",_iconMarker,_coords,_crates]] call GMS_fnc_log; - }; - //diag_log format["monitorInitializedMission (333): _spawnCrates Timing = %1 / crates spawned = %2",_spawnCratesTiming,_crates]; - if (GMS_cleanUpLootChests) then - { - _objects append _crates; - }; - if (_loadCratesTiming isEqualTo "atMissionSpawn") then - { - private _crateMoney = missionNamespace getVariable (format["GMS_crateMoney%1",_difficulty]); - //[format["_monitorInitializedMissions (341) _crateMoney = %1",_crateMoney]] call GMS_fnc_log; - { - [_x,missionNamespace getVariable (format["GMS_crateMoney%1",_difficulty])] call GMS_fnc_setMoney; - } forEach _crates; - //diag_log format["monitorInitializedMission (345): _iconMarker %1 | Loot LOADED _loadCrates Timing = %2",_iconMarker,_loadCratesTiming]; - } else { - //diag_log format["monitorInitializedMission (347): _iconMarker %1 | NO Loot LOADED _loadCrates Timing = %2",_iconMarker,_loadCratesTiming]; - }; - }; - //[format["_monitorInitializedMissions (351): added crates, count _crates = %1 | _crates = %2",count _crates, _crates]] call GMS_fnc_log; - uiSleep 1; - // [format["_monitorInitializedMissions (353): _markers selet 1 = %1 | _iconMarker = %2",_markers select 1, _iconMarker]] call GMS_fnc_log; - if (GMS_showCountAliveAI) then - { - GMS_missionLabelMarkers pushBack [ - _markers select 1, // The icon marker used for adding text to markers - _markerConfigs select 1, // The name of the mission shown to players on markers and in allerts - _missionInfantry // The array of units tied to the mission used in this case to keep a count of units still alive that is shown on the map - ]; - }; - - { - _x setVariable["crateSpawnPos", (getPos _x)]; - } forEach _crates; - //[format["_monitorInitializedMissions (361): _shapedMarker %1 | _mines = %3",_shapedMarker,_coords,_mines]] call GMS_fnc_log; - //[format["_monitorInitializedMissions (362): _shapedMarker %1 | _crates = %3",_shapedMarker,_coords,_crates]] call GMS_fnc_log; - #define indexMines 1 - #define indexCrates 4 - _missionData set[indexMines, _mines]; - _missionData set[indexCrates, _crates]; - //_missionData = [_coords,_mines,_objects,_hiddenObjects,_crates,_missionInfantry,_assetSpawned,_aiVehicles,_lootVehicles,_markers]; - - //_el set[missionData, _missionData]; - - // Everything spawned withouth serious errors so lets keep the mission active for future monitoring - //_spawningMission = false; - _missionsList pushBack _el; - _el params [ - "_key", - "_missionTimeoutAt", // 1 // server time at which the mission times out. - "_triggered", // 2 // integer - specifies if mission was triggered by a player or scripting such as debug setting - "_missionData", // 4 // variable containing information specific to this instance of the mission such as location and objects - "_missionConfigs" // 5 // Variables regarding the configuration of the dynamic mission - ]; - _missionData params [ - "_coords", - "_mines", - "_objects", - "_hiddenObjects", - "_crates", - "_missionInfantry", - "_assetSpawned", - "_aiVehicles", - "_lootVehicles", - "_markers" - ]; - //[format["_monitorInitializedMissions (393): _shapedMarker %1 | _coords %2 | count _mines %3 | count _objects %4 | _crates %5",_shapedMarker,_coords,count _mines,count _objects,_crates]] call GMS_fnc_log; + _missionConfigs set[isSpawned,true]; + GMS_monitorTriggered = _el select triggered; + _missionsList pushBack _el; }; }; //diag_log format["_monitorInitializedMissions (396) End of Code Block | GMS_initializedMissionsList = %1",GMS_initializedMissionsList]; diff --git a/@GMS/addons/GMS/Compiles/Missions/fn_monitorSpawnedMissions.sqf b/@GMS/addons/GMS/Compiles/Missions/fn_monitorSpawnedMissions.sqf index ef8bb5a..6bb31c7 100644 --- a/@GMS/addons/GMS/Compiles/Missions/fn_monitorSpawnedMissions.sqf +++ b/@GMS/addons/GMS/Compiles/Missions/fn_monitorSpawnedMissions.sqf @@ -30,7 +30,8 @@ for "_i" from 1 to (count _missionsList) do "_triggered", // 2 // integer - specifies if mission was triggered by a player or scripting such as debug setting "_missionData", // 4 // variable containing information specific to this instance of the mission such as location and objects "_missionConfigs", // 5 // Variables regarding the configuration of the dynamic mission - "_spawnPara" + "_spawnPara", + "_isStatic" ]; #define triggered 2 #define spawnPara 5 @@ -58,7 +59,11 @@ for "_i" from 1 to (count _missionsList) do "_missionLootConfigs", "_aiConfigs", "_missionMessages", - "_paraConfigs" + "_paraConfigs", + "_defaultMissionLocations", + "_maxMissionRespawns", + "_timesSpawned", + "_isSpawned" ]; private _missionComplete = -1; @@ -80,8 +85,11 @@ for "_i" from 1 to (count _missionsList) do private _playerIsNearCrates = [_crates,20,true] call GMS_fnc_playerInRangeArray; private _playerIsNearCenter = [_coords,20,true] call GMS_fnc_playerInRange; private _playerIsNear = if (_playerIsNearCrates || {_playerIsNearCenter}) then {true} else {false}; + GMS_playerIsNear = _playerIsnear; + private _minNoAliveForCompletion = (count _missionInfantry) - (round(GMS_killPercentage * (count _missionInfantry))); private _aiKilled = if (({alive _x} count _missionInfantry) <= _minNoAliveForCompletion) then {true} else {false}; // mission complete + GMS_aiKilled = _aiKilled; if (_endIfPlayerNear && {_playerIsNear}) then {throw 1}; // mission complete if (_endIfAIKilled && {_aiKilled}) then {throw 1}; @@ -188,7 +196,9 @@ for "_i" from 1 to (count _missionsList) do "_spawnCratesTiming", "_loadCratesTiming", "_crateLoot", - "_lootCounts" // A trunkated list of variables is parsed as we do not need all of them + "_lootCounts", + "_missionLootBoxes", + "_missionLootVehicles" ]; _missionMessages params [ @@ -271,8 +281,9 @@ for "_i" from 1 to (count _missionsList) do ["_isScuba",false], ["_endCode",-1] */ - [format["_monitorSpawnedMissions (case 1): _markerConfigs %1 | _endMsg %2",_markerConfigs,_endMsg]] call GMS_fnc_log; + //[format["_monitorSpawnedMissions (case 1): _markerConfigs %1 | _endMsg %2",_markerConfigs,_endMsg]] call GMS_fnc_log; [_key, _missionData, _endMsg, _markerConfigs, _missionLootConfigs,_isscubamission, 1] call GMS_fnc_endMission; + _missionConfigs set [isSpawned,false]; //[format["_monitorSpawnedMissions (265): _markerMissionName %1: end of case 1 for mission completion",_markerMissionName]] call GMS_fnc_log; }; @@ -288,7 +299,8 @@ for "_i" from 1 to (count _missionsList) do ["_endCode",-1] */ //[format["_monitorSpawnedMissions (case 2): _markerConfigs %1 | _endMsg %2",_markerConfigs,_endMsg]] call GMS_fnc_log; - [_key, _missionData, _endMsg, _markerConfigs, _missionLootConfigs, _isscubamission, 2] call GMS_fnc_endMission; + [_key, _missionData, _endMsg, _markerConfigs, _missionLootConfigs, _isscubamission, 2] call GMS_fnc_endMission; + _missionConfigs set [isSpawned,false]; }; case 3: { // Abort, key asset killed @@ -302,7 +314,8 @@ for "_i" from 1 to (count _missionsList) do ["_endCode",-1] */ //[format["_monitorSpawnedMissions (case 3): _markerConfigs %1 | _assetKilledMsg %2",_markerConfigs,_assetKilledMsg]] call GMS_fnc_log; - [_key, _missionData, _assetKilledMsg, _markerConfigs, _missionLootConfigs,_isscubamission, 3] call GMS_fnc_endMission; + [_key, _missionData, _assetKilledMsg, _markerConfigs, _missionLootConfigs,_isscubamission, 3] call GMS_fnc_endMission; + _missionConfigs set [isSpawned,false]; }; case 4: { @@ -318,7 +331,8 @@ for "_i" from 1 to (count _missionsList) do ["_endCode",-1] */ //diag_log format["_monitorSpawnedMissions: (286): _crates = %1 | _mines = %2",_crates,_mines]; - [_key, _missionData, "DEBUG SETTING >= 4", _markerConfigs, _missionLootConfigs, _isscubamission, 4] call GMS_fnc_endMission; + [_key, _missionData, "DEBUG SETTING >= 4", _markerConfigs, _missionLootConfigs, _isscubamission, 4] call GMS_fnc_endMission; + _missionConfigs set [isSpawned,false]; }; case 5: { // SIMULATED Normal Mission End @@ -387,6 +401,7 @@ for "_i" from 1 to (count _missionsList) do //diag_log format["_monitorSpawnedMissions: (360):_crates = %1",_crates]; [_key, _missionData, _endMsg, _markerConfigs, _missionLootConfigs,_isscubamission, 5] call GMS_fnc_endMission; + _missionConfigs set [isSpawned,false]; //[format["_monitorSpawnedMissions (363): _markerMissionName %1: end of case 1 for mission completion",_markerMissionName]] call GMS_fnc_log; }; }; diff --git a/@GMS/addons/GMS/Compiles/Missions/fn_spawnEmplacedWeaponArray.sqf b/@GMS/addons/GMS/Compiles/Missions/fn_spawnEmplacedWeaponArray.sqf index b0f3940..1905819 100644 --- a/@GMS/addons/GMS/Compiles/Missions/fn_spawnEmplacedWeaponArray.sqf +++ b/@GMS/addons/GMS/Compiles/Missions/fn_spawnEmplacedWeaponArray.sqf @@ -1,18 +1,9 @@ /* - - [_missionEmplacedWeapons,_noEmplacedWeapons,_aiDifficultyLevel,_coords,_uniforms,_headGear] call GMS_fnc_spawnEmplacedWeaponArray; By Ghostrider [GRG] - - -------------------------- - License - -------------------------- - All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. - - http://creativecommons.org/licenses/by-nc-sa/4.0/ */ #include "\GMS\Compiles\Init\GMS_defines.hpp" -params["_coords",["_missionEmplacedWeapons",[]],["_useRelativePos",true],["_noEmplacedWeapons",0],["_aiDifficultyLevel","red"],["_uniforms",[]], ["_headGear",[]],["_vests",[]],["_backpacks",[]],["_weaponList",[]],["_sideArms",[]]]; +params["_coords",["_missionEmplacedWeapons",[]],["_useRelativePos",true],["_aiDifficultyLevel","red"],["_uniforms",[]], ["_headGear",[]],["_vests",[]],["_backpacks",[]],["_weaponList",[]],["_sideArms",[]]]; if (_uniforms isEqualTo []) then {_uniforms = [_aiDifficultyLevel] call GMS_fnc_selectAIUniforms}; if (_headGear isEqualTo []) then {_headGear = [_aiDifficultyLevel] call GMS_fnc_selectAIHeadgear}; if (_vests isEqualTo []) then {_vests = [_aiDifficultyLevel] call GMS_fnc_selectAIVests}; @@ -20,7 +11,7 @@ if (_backpacks isEqualTo []) then {_backpacks = [_aiDifficultyLevel] call GMS if (_weaponList isEqualTo []) then {_weaponList = [_aiDifficultyLevel] call GMS_fnc_selectAILoadout}; if (_sideArms isEqualTo []) then {[_aiDifficultyLevel] call GMS_fnc_selectAISidearms}; -private["_emplacedWeps","_emplacedAI","_wep","_units","_gunner","_abort","_pos","_mode","_useRelativePos","_useRelativePos"]; +private["_emplacedWeps","_emplacedAI","_wep","_units","_gunner","_abort","_pos","_mode"]; _emplacedWeps = []; _emplacedAI = []; _units = []; @@ -28,20 +19,8 @@ _abort = false; _pos = []; private _emplacedWepData = +_missionEmplacedWeapons; // So we dont overwrite this for the next instance of the mission -//diag_log format["_spawnEmplacedWeaponArray(30): _noEmplacedWeapons = %1 | _emplacedWepData = %2",_noEmplacedWeapons,_emplacedWepData]; - -// Define _emplacedWepData if not already configured. -if (_emplacedWepData isEqualTo []) then -{ - private _wepPositions = [_coords,_noEmplacedWeapons,35,50] call GMS_fnc_findPositionsAlongARadius; - { - _static = selectRandom GMS_staticWeapons; - _emplacedWepData pushback [_static,_x]; - } forEach _wepPositions; - _useRelativePos = false; -}; - -//diag_log format["_spawnEmplacedWeaponArray(45): _noEmplacedWeapons = %1 | _emplacedWepData = %2",_noEmplacedWeapons,_emplacedWepData]; +//diag_log format["_spawnEmplacedWeaponArray(31): _useRelativePos = %1",_useRelativePos]; +//diag_log format["_spawnEmplacedWeaponArray(32): count _emplacedWepData = %1 | _emplacedWepData = %2",count _emplacedWepData,_emplacedWepData]; { _x params [["_static",""],["_pos",[0,0,0]],["_dir",0]]; @@ -88,6 +67,7 @@ if (_emplacedWepData isEqualTo []) then _wep setVariable["GMS_vehType","emplaced"]; _emplacedWeps pushback _wep; [_wep,_empGroup] call GMSCore_fnc_loadVehicleCrew; + //diag_log format["_spawnEmplacedWeaponArray(91): _wep = %1 | getPos _wep = %2 | _static = %3",_wep, getPosATL _wep, _static]; //_gunner setVariable["GRG_vehType","emplaced"]; _emplacedAI append _units; } forEach _emplacedWepData; diff --git a/@GMS/addons/GMS/Compiles/Missions/fn_spawnMissionAssets.sqf b/@GMS/addons/GMS/Compiles/Missions/fn_spawnMissionAssets.sqf new file mode 100644 index 0000000..228a7c1 --- /dev/null +++ b/@GMS/addons/GMS/Compiles/Missions/fn_spawnMissionAssets.sqf @@ -0,0 +1,366 @@ +/* + GMS_fnc_spawnMissionAssets + Copyright 2023 Ghostrider[GRG] +*/ + +params[ + "_missionData", // Defined below + "_missionConfigs", // Defined below + "_spawnPara" +]; + +#define triggered 2 +#define missionCoords _missionData select 0 +#define delayTime 1 +#define noActive 2 +#define waitTime 5 +#define missionData 6 + +_missionData params [ + "_coords", + "_mines", + "_objects", + "_hiddenObjects", + "_crates", + "_missionInfantry", + "_assetSpawned", + "_aiVehicles", + "_lootVehicles", + "_markers" +]; +_missionConfigs params[ + "_difficulty", + "_markerConfigs", + "_endCondition", + "_isscubamission", + "_missionLootConfigs", + "_aiConfigs", + "_missionMessages", + "_paraConfigs", + "_defaultMissionLocations" +]; +_markers params[ + "_shapedMarker", + "_iconMarker" +]; +_missionMessages params [ + "_assetKilledMsg", + "_endMsg", + "_startMsg" +]; +_missionLootConfigs params [ + "_spawnCratesTiming", + "_loadCratesTiming", + "_crateLoot", + "_lootCounts", + "_missionLootBoxes", + "_missionLootVehicles" +]; +_aiConfigs params [ + "_uniforms", + "_headgear", + "_vests", + "_backpacks", + "_weaponList", + "_sideArms", + "_missionLandscapeMode", + "_garrisonedBuildings_BuildingPosnSystem", + "_garrisonedBuilding_ATLsystem", + "_missionLandscape", + "_simpleObjects", + "_missionPatrolVehicles", + "_submarinePatrols", // Added Build 227 + "_submarinePatrolParameters", + "_airPatrols", + "_noVehiclePatrols", + "_vehicleCrewCount", + "_missionEmplacedWeapons", + "_noEmplacedWeapons", + "_useMines", + "_minNoAI", + "_maxNoAI", + "_noAIGroups", + "_missionGroups", + "_scubaPatrols", // Added Build 227 + "_scubaGroupParameters", + "_hostageConfig", + "_enemyLeaderConfig", + "_chanceHeliPatrol", + "_noChoppers", + "_missionHelis" +]; +_markerConfigs params[ + "_markerName", // The unique text identifier for the marker + "_markerMissionName" +]; + +private["_temp"]; +if (GMS_SmokeAtMissions select 0) then // spawn a fire and smoke near the crate +{ + _temp = [_coords,GMS_SmokeAtMissions select 1] call GMS_fnc_smokeAtCrates; + _objects append _temp; + uiSleep delayTime; +}; + +if (_useMines) then +{ + _temp = [_coords] call GMS_fnc_spawnMines; + _mines = _temp; + uiSleep delayTime; +}; + +if (_missionLandscapeMode isEqualTo "random") then +{ + _temp = [_coords,_missionLandscape, 3, 15, 2] call GMS_fnc_spawnRandomLandscape; +} else { + _temp = [_coords, _missionLandscape] call GMS_fnc_spawnCompositionObjects; +}; +_temp params["_obj","_hiddenObj"]; +_objects append _obj; +_hiddenObjects append _hiddenObj; +uiSleep delayTime; + +_temp = [_coords,_simpleObjects,true] call GMS_fnc_spawnSimpleObjects; +_objects append _temp; + +if (!(_missionGroups isEqualTo []) || _noAIGroups > 0) then // The idea is that defining groups in _missionGroups overrides the _noAIGroups setting +{ + _ai = [_coords, _minNoAI,_maxNoAI,_noAIGroups,_missionGroups,_difficulty,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms,_isScubaMission] call GMS_fnc_spawnMissionAI; + _missionInfantry append _ai; + uiSleep delayTime; +}; + +if (!(_scubaGroupParameters isEqualTo []) || {_scubaPatrols > 0}) then +{ + _ai = [_coords, _minNoAI,_maxNoAI,_scubaPatrols,_scubaGroupParameters,_difficulty,GMS_UMS_uniforms,GMS_UMS_headgear,GMS_UMS_vests,_backpacks,GMS_UMS_weapons,_sideArms,true] call GMS_fnc_spawnMissionAI; + _missionInfantry append _ai; + uiSleep delayTime; +}; + +// TODO: 05/08/22 -> redo code to handle this +if !(_hostageConfig isEqualTo []) then +{ + _temp = [_coords,_hostageConfig] call GMS_fnc_spawnHostage; + _assetSpawned = _temp select 0; + _objects pushBack (_temp select 1); // The building in which the asset was spawned. + uiSleep delayTime; +}; + +// TODO: 05/08/22 -> redo code to handle this +if !(_enemyLeaderConfig isEqualTo []) then +{ + _temp = [_coords,_enemyLeaderConfig] call GMS_fnc_spawnLeader; + if (_temp isEqualTo grpNull) then {throw 1} else + { + _assetSpawned = _temp select 0; + _objects pushBack (_temp select 1); // The building in which the asset was spawned. + _missionInfantry pushBack _assetSpawned; + }; + uiSleep delayTime; +}; + +// TODO: 05/08/22 -> redo code to handle this +if !(_garrisonedBuilding_ATLsystem isEqualTo []) then // Note that there is no error checking here for nulGroups +{ + _temp = [_coords, _garrisonedBuilding_ATLsystem, _difficulty,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call GMS_fnc_garrisonBuilding_ATLsystem; + _temp params["_unitsSpawned","_staticsSpawned","_buildingsSpawned"]; + _objects append _buildingsSpawned; + GMS_monitoredVehicles append _staticsSpawned; + _missionInfantry append _unitsSpawned; + uiSleep delayTime; +}; + + +if !(_garrisonedBuildings_BuildingPosnSystem isEqualTo []) then +{ + _temp = [_coords, _garrisonedBuildings_BuildingPosnSystem, _difficulty,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call GMS_fnc_garrisonBuilding_RelPosSystem; + _objects append (_temp select 1); + GMS_monitoredVehicles append (_temp select 2); + _missionInfantry append (units (_temp select 0)); + uiSleep delayTime; +}; + +/* GMS_fnc_garrisonBuilding_RelPosSystem + params["_coords", + ["_missionEmplacedWeapons",[]], + ["_useRelativePos",true], + ["_aiDifficultyLevel","red"], + ["_uniforms",[]], + ["_headGear",[]], + ["_vests",[]], + ["_backpacks",[]], + ["_weaponList",[]], + ["_sideArms",[]]]; +*/ +private _userelativepos = true; +private _numberEmplacedWeaponsThisMission = [_noEmplacedWeapons] call GMSCore_fnc_getNumberFromRange; +if (GMS_useStatic && {!(_missionEmplacedWeapons isEqualTo [])} ) then +{ + _temp = [_coords,_missionEmplacedWeapons,_userelativepos,_difficulty,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call GMS_fnc_spawnEmplacedWeaponArray; + _temp params["_statics","_units"]; + _objects append _statics; + _missionInfantry append _units; + [format["_monitorInitializedMissions (288): spawned emplaced weapons for _iconMarker %1 at %2 | with count _missionInfantry = %3 | with _statics = %4",_iconMarker,diag_tickTime,count _missionInfantry, _statics]]; + uisleep delayTime; +} else { + private _wepPositions = [_coords,_noEmplacedWeapons,35,50] call GMS_fnc_findPositionsAlongARadius; + private _emplacedWeaponsRandom = []; + { + _static = selectRandom GMS_staticWeapons; + _emplacedWeaponsRandom pushback [_static,_x]; + } forEach _wepPositions; + _useRelativePos = false; + _temp = [_coords,_emplacedWeaponsRandom,_userelativepos,_difficulty,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call GMS_fnc_spawnEmplacedWeaponArray; + _temp params["_statics","_units"]; + _objects append _statics; + _missionInfantry append _units; + [format["_monitorInitializedMissions (233788): spawned emplaced weapons for _iconMarker %1 at %2 | with count _missionInfantry = %3 | with _statics = %4",_iconMarker,diag_tickTime,count _missionInfantry, _statics]]; + uisleep delayTime; +}; + +if !(_missionLootVehicles isEqualTo []) then +{ + _lootVehicles = [_coords,_missionLootVehicles,_spawnCratesTiming] call GMS_fnc_spawnMissionLootVehicles; + uiSleep delayTime; +}; + +/* GMS_fnc_spawnMissionVehiclePatrols + params[ + ["_coords",[]], + ["_skillAI","Red"], + ["_missionPatrolVehicles",[]], + ["_useRelativePos",true], + ["_uniforms",[]], + ["_headGear",[]], + ["_vests",[]], + ["_backpacks",[]], + ["_weaponList",[]], + ["_sideArms",[]], + ["_isScubaGroup",false], + ["_crewCount",4] + ]; +*/ +private _noPatrols = [_noVehiclePatrols] call GMSCore_fnc_getNumberFromRange; +if (GMS_useVehiclePatrols && {!(_missionPatrolVehicles isEqualTo [])}) then +{ + _temp = [_coords,_difficulty,_missionPatrolVehicles,_userelativepos,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms,false,_vehicleCrewCount] call GMS_fnc_spawnMissionVehiclePatrols; + _temp params["_vehs","_units"]; + _aiVehicles append _vehs; + _missionInfantry append _units; + uiSleep delayTime; +} else { + if (GMS_useVehiclePatrols && {(_noPatrols > 0)}) then + { + _useRelativePos = false; + private _spawnLocations = [_coords,_noVehiclePatrols,60,100] call GMS_fnc_findPositionsAlongARadius; + private _vicsToSpawn = []; + { + private _veh = [_difficulty] call GMS_fnc_selectPatrolVehicle; + [format["GMS_fnc_spawnMissionVehiclePatrols: _veh %1 = %2",_forEachIndex,_veh]] call GMS_fnc_log; + _vicsToSpawn pushBack [_veh, _x]; + }forEach _spawnLocations; + _temp = [_coords,_difficulty,_vicsToSpawn,_userelativepos,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms,false,_vehicleCrewCount] call GMS_fnc_spawnMissionVehiclePatrols; + _temp params["_vehs","_units"]; + + _aiVehicles append _vehs; + _missionInfantry append _units; + uiSleep delayTime; + }; +}; + +if (GMS_useVehiclePatrols && {((_submarinePatrols > 0) || {!(_submarinePatrolParameters isEqualTo [])} )} ) then +{ + _temp = [_coords,_noPatrols,_difficulty,_submarinePatrolParameters,_userelativepos,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms,_isScubaMission,_vehicleCrewCount] call GMS_fnc_spawnMissionVehiclePatrols; + _temp params["_vehs","_units"]; + GMS_monitoredVehicles append _vehs; + GMS_landVehiclePatrols append _vehs; + _aiVehicles append _vehs; + _missionInfantry append _units; + uiSleep delayTime; +}; + +/* GMS_fnc_spawnMissionHelis + params[ + ["_coords",[0,0,0]], + ["_missionHelis",[]], + ["_difficulty","Red"], + ["_uniforms",[]], + ["_headgear",[]], + ["_vests",[]], + ["_backpacks",[]], + ["_weaponList",[]], + ["_sideArms",[]] + ]; +*/ +private _noChoppers = [_noChoppers] call GMSCore_fnc_getNumberFromRange; +if !(_airPatrols isEqualTo [] && {random(1) < _chanceHeliPatrol}) then // Spawn any choppers defined in the array +{ + _temp = [_coords, _airPatrols,_difficulty,_uniforms,_headgear,_vests,_backpacks,_weaponList,_sidearms] call GMS_fnc_spawnMissionHelis; + _temp params["_helisSpawned","_unitsSpawned"]; + GMS_monitoredVehicles append _helisSpawned; + GMS_aircraftPatrols append _helisSpawned; // Used to find nearest heli ... + _aiVehicles append _helisSpawned; + _missionInfantry append _unitsSpawned; + uisleep delayTime; +} else { + if ((_noChoppers > 0) && {random(1) < _chanceHeliPatrol}) then + { + private _spawnLocations = [_coords,_noChoppers,100,120] call GMS_fnc_findPositionsAlongARadius; + private _helisToSpawn = []; + private _availableHelis = [_difficulty] call GMS_fnc_selectMissionHelis; + for "_i" from 1 to _noChoppers do + { + private _heli = selectRandom _availableHelis; + _helisToSpawn pushBack[_heli,_x,0]; + }; + _temp = [_coords,_helisToSpawn,_difficulty,_uniforms,_headGear,_vests,_backpacks,_weaponList, _sideArms] call GMS_fnc_spawnMissionHelis; + _temp params["_helisSpawned","_unitsSpawned"]; + GMS_monitoredVehicles append _helisSpawned; + GMS_aircraftPatrols append _helisSpawned; // Used to find nearest heli ... + _aiVehicles append _helisSpawned; + _missionInfantry append _unitsSpawned; + uisleep delayTime; + }; +}; + +if (_spawnCratesTiming in ["atMissionSpawnGround","atMissionSpawnAir"]) then +{ + if (_missionLootBoxes isEqualTo []) then + { + _crates = [_coords,[[selectRandom GMS_crateTypes,[1,1,0],_crateLoot,_lootCounts]], _loadCratesTiming, _spawnCratesTiming, "start", _difficulty] call GMS_fnc_spawnMissionCrates; + } + else + { + _crates = [_coords,_missionLootBoxes,_loadCratesTiming, _spawnCratesTiming, "start", _difficulty] call GMS_fnc_spawnMissionCrates; + }; + + if (GMS_cleanUpLootChests) then + { + _objects append _crates; + }; + if (_loadCratesTiming isEqualTo "atMissionSpawn") then + { + private _crateMoney = missionNamespace getVariable (format["GMS_crateMoney%1",_difficulty]); + { + [_x,missionNamespace getVariable (format["GMS_crateMoney%1",_difficulty])] call GMS_fnc_setMoney; + } forEach _crates; + }; + uiSleep 1; +}; + +if (GMS_showCountAliveAI) then +{ + GMS_missionLabelMarkers pushBack [ + _markers select 1, // The icon marker used for adding text to markers + _markerConfigs select 1, // The name of the mission shown to players on markers and in allerts + _missionInfantry // The array of units tied to the mission used in this case to keep a count of units still alive that is shown on the map + ]; +}; + +{ + _x setVariable["crateSpawnPos", (getPos _x)]; +}; +#define indexMines 1 +#define indexCrates 4 +_missionData set[indexMines, _mines]; +_missionData set[indexCrates, _crates]; diff --git a/@GMS/addons/GMS/Compiles/Missions/fn_spawnMissionHelis.sqf b/@GMS/addons/GMS/Compiles/Missions/fn_spawnMissionHelis.sqf index a93856a..3441089 100644 --- a/@GMS/addons/GMS/Compiles/Missions/fn_spawnMissionHelis.sqf +++ b/@GMS/addons/GMS/Compiles/Missions/fn_spawnMissionHelis.sqf @@ -5,7 +5,6 @@ #include "\GMS\Compiles\Init\GMS_defines.hpp" params[ ["_coords",[0,0,0]], - ["_noChoppers",0], ["_missionHelis",[]], ["_difficulty","Red"], ["_uniforms",[]], @@ -17,16 +16,16 @@ params[ ]; private _helis = []; private _units = []; -for "_i" from 0 to (_noChoppers) do +//diag_log format["_spawnMissionHelis (19): GMS_monitoringInitPass = %3 | count _missionHelis = %1 | _missionHelis = %2",count _missionHelis,_missionHelis, GMS_monitoringInitPass]; { - private _spawnPos = _coords getPos[30,random(359)]; - private _heli = selectRandom _missionHelis; + _x params["_heli","_relPos","_direction"]; private _noCrew = [_heli,false] call BIS_fnc_crewCount; + private _spawnPos = _coords vectorDiff _relPos; #define patrolArea [1000,1000] private _crewGroup = [_spawnPos,_noCrew,_difficulty,patrolArea,_uniforms,_headGear,_vests,_backpacks,_weaponList, _sideArms] call GMS_fnc_spawnGroup; _crewGroup setVariable["GMS_group",true]; _units append (units _crewGroup); - + //diag_log format["_spawnMissionHelis(27): _noCrew = %1 | _crewGroup = %2| _heil = %3 | _relPos = %4",_noCrew, _crewGroup, _heli, _relPos]; #define heliDir 0 #define heliHeight 100 #define heliRemoveFuel 0.2 @@ -34,7 +33,7 @@ for "_i" from 0 to (_noChoppers) do #define vehHitCode [GMS_fnc_vehicleHit] #define vehKilledCode [GMS_fnc_vehicleKilled] private _releaseToPlayers = GMS_allowClaimVehicle; - // the function returns the vehicle object spawned (_aircraft) + // GMSCore_fnc_spawnPatrolAircraft returns the vehicle object spawned (_aircraft) /* params[ ["_className",""], @@ -50,9 +49,10 @@ for "_i" from 0 to (_noChoppers) do ["_vehKilledCode",[]] ]; */ - - private _aircraft = [_heli,_crewGroup,_spawnPos,heliDir,heliHeight,heliDamage,heliRemoveFuel,_releaseToPlayers,GMS_vehicleDeleteTimer,vehHitCode,vehKilledCode] call GMSCore_fnc_spawnPatrolAircraft; + private _aircraft = [_heli,_crewGroup,_spawnPos,_direction,heliHeight,heliDamage,heliRemoveFuel,_releaseToPlayers,GMS_vehicleDeleteTimer,vehHitCode,vehKilledCode] call GMSCore_fnc_spawnPatrolAircraft; _helis pushBack _aircraft; -}; - +} forEach _missionHelis; +diag_log format["_spawnMissionHelis: GMS_spawnHelisPass = %1 | GMS_monitorTriggered = %2",GMS_spawnHelisPass, GMS_monitorTriggered]; +diag_log format["_spawnMissionHelis: GMS_playerIsNear = %1 | GMS_aiKilled = %2", GMS_playerIsNear, GMS_aiKilled]; +GMS_spawnHelisPass = GMS_spawnHelisPass + 1; [_helis,_units] \ No newline at end of file diff --git a/@GMS/addons/GMS/Compiles/Missions/fn_spawnMissionVehiclePatrols.sqf b/@GMS/addons/GMS/Compiles/Missions/fn_spawnMissionVehiclePatrols.sqf index 196a94d..cb9e8e2 100644 --- a/@GMS/addons/GMS/Compiles/Missions/fn_spawnMissionVehiclePatrols.sqf +++ b/@GMS/addons/GMS/Compiles/Missions/fn_spawnMissionVehiclePatrols.sqf @@ -14,11 +14,10 @@ #include "\GMS\Compiles\Init\GMS_defines.hpp" params[ - "_coords", - "_noVehiclePatrols", - "_skillAI", - "_missionPatrolVehicles" - ,["_useRelativePos",true], + ["_coords",[]], + ["_skillAI","Red"], + ["_missionPatrolVehicles",[]], + ["_useRelativePos",true], ["_uniforms",[]], ["_headGear",[]], ["_vests",[]], @@ -32,23 +31,8 @@ params[ private["_spawnPos"]; private _vehicles = []; private _missionAI = []; -private _abort = false; private _patrolsThisMission = +_missionPatrolVehicles; -//diag_log format["_spawnMissionVehiclePatrols(30): _noVehiclePatrols = %1 | _patrolsThisMission = %2",_noVehiclePatrols,_patrolsThisMission]; -if (_patrolsThisMission isEqualTo []) then -{ - _useRelativePos = false; - private _spawnLocations = [_coords,_noVehiclePatrols,60,100] call GMS_fnc_findPositionsAlongARadius; - //diag_log format["_spawnMissionVehiclePatrols (35): _spawnLocations = %1",_spawnLocations]; - { - - private _veh = [_skillAI] call GMS_fnc_selectPatrolVehicle; - [format["GMS_fnc_spawnMissionVehiclePatrols: _veh %1 = %2",_forEachIndex,_veh]] call GMS_fnc_log; - _patrolsThisMission pushBack [_veh, _x]; - //diag_log format["_spawnMissionVehiclePatrols(36): _v = %1 | _patrolsThisMission = %2",_v,_patrolsThisMission]; - }forEach _spawnLocations; -}; -//diag_log format["_spawnMissionVehiclePatrols(42): _patrolsThisMission = %1",_patrolsThisMission]; +//diag_log format["_spawnMissionVehiclePatrols(42): count _patrolsThisMission = %1 | _patrolsThisMission = %2",count _patrolsThisMission, _patrolsThisMission]; #define configureWaypoints false { _x params["_vehName","_pos"]; @@ -84,5 +68,5 @@ if (_patrolsThisMission isEqualTo []) then } forEach _patrolsThisMission; GMS_landVehiclePatrols append _vehicles; GMS_monitoredVehicles append _vehicles; -[_vehicles, _missionAI, _abort]; +[_vehicles, _missionAI]; diff --git a/@GMS/addons/GMS/Compiles/Missions/fn_spawnNewMissions.sqf b/@GMS/addons/GMS/Compiles/Missions/fn_spawnNewMissions.sqf index 7285330..bd72ae6 100644 --- a/@GMS/addons/GMS/Compiles/Missions/fn_spawnNewMissions.sqf +++ b/@GMS/addons/GMS/Compiles/Missions/fn_spawnNewMissions.sqf @@ -14,7 +14,7 @@ http://creativecommons.org/licenses/by-nc-sa/4.0/ */ #include "\GMS\Compiles\Init\GMS_defines.hpp" -// Need to debug for GMS +// TODO: Need to debug for GMS if (GMS_missionsRunning >= GMS_maxSpawnedMissions) exitWith { [format["_spawnNewMissions (18): GMS_maxSpawnedMissions of %1 Reached",GMS_maxSpawnedMissions]] call GMS_fnc_log; @@ -22,28 +22,36 @@ if (GMS_missionsRunning >= GMS_maxSpawnedMissions) exitWith { private _missionDescriptors = _x; - _missionDescriptors params["_key","_difficulty","_maxMissions","_activeMissions","_tMin","_tMax","_waitTime","_missions"]; + _missionDescriptors params["_key","_difficulty","_maxMissions","_activeMissions","_tMin","_tMax","_waitTime","_missions","_isStatic"]; if (_activeMissions < _maxMissions && {diag_tickTime > _waitTime && {GMS_missionsRunning < GMS_maxSpawnedMissions}}) then { // time to reset timers and spawn something. private _missionSelected = selectRandom _missions; - //[format["_spawnNewMissions (29): _key %1 | _difficulty %2 | _maxMissions %3 | _activeMissions %4 | _tMin %5 | _tMax %6 | _waitTime %7",_key,_difficulty,_maxMissions,_activeMissions,_tMin,_tMax,_waitTime]] call GMS_fnc_log; - private _missionInitialized = [_key,_missionSelected,GMS_dynamicMissionsSpawned] call GMS_fnc_initializeMission; + /* + params[ + "_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 + "_missionConfigs", // Selfevident but this is an array with all configs for the mission + "_missionCount", // The number of missions run thus far which is used to unsure each marker has a unique name + "_isStatic" // true if this is a static mission + ]; + */ - if (_missionInitialized == 1) then + private _missionInitialized = [_key,_missionSelected,GMS_dynamicMissionsSpawned,_isStatic] call GMS_fnc_initializeMission; + + switch (_missionInitialized) do { - GMS_dynamicMissionsSpawned = GMS_dynamicMissionsSpawned + 1; - #define waitTime 6 - #define noActive 3 - private _wt = diag_tickTime + _tmin + (random(_tMax - _tMin)); - _x set[waitTime, _wt]; // _x here is the _missionCategoryDescriptors being evaluated - private _noActiveMissions = _x select noActive; - _x set[noActive, _noActiveMissions + 1]; - }; - if (_missionInitialized == 2) then - { - _missions deleteAt (_missions find _missionSelected); + case 1: { // This is a dynamic mission s see if we can spawn another instance of this categore (blue, red, green, orange) + GMS_dynamicMissionsSpawned = GMS_dynamicMissionsSpawned + 1; + #define waitTime 6 + #define noActive 3 + private _wt = diag_tickTime + _tmin + (random(_tMax - _tMin)); + _x set[waitTime, _wt]; // _x here is the _missionCategoryDescriptors being evaluated + private _noActiveMissions = _x select noActive; + _x set[noActive, _noActiveMissions + 1]; + }; + case 2: {_missions deleteAt (_missions find _missionSelected)}; // the mission was spawned the maxiumum number of times. + case 3: {}; // this is a static mission that was spawned and not completed }; }; } forEach GMS_missionData; diff --git a/@GMS/addons/GMS/Compiles/init/GMS_defines.hpp b/@GMS/addons/GMS/Compiles/init/GMS_defines.hpp index 476a1be..3ecc4c6 100644 --- a/@GMS/addons/GMS/Compiles/init/GMS_defines.hpp +++ b/@GMS/addons/GMS/Compiles/init/GMS_defines.hpp @@ -49,6 +49,9 @@ #define atMissionEndGround 2 #define atMissionEndAir 3 +// Defines for mission spawning functions +#define isSpawned 11 + // defines for static group spawners #define staticPatrolTriggerRange 2000 #define groupParameters 0 diff --git a/@GMS/addons/GMS/Compiles/init/fn_init.sqf b/@GMS/addons/GMS/Compiles/init/fn_init.sqf index b046a5d..f98b442 100644 --- a/@GMS/addons/GMS/Compiles/init/fn_init.sqf +++ b/@GMS/addons/GMS/Compiles/init/fn_init.sqf @@ -180,8 +180,7 @@ if (GMS_numberUnderwaterDynamicMissions > 0) then [_missionListUMS,_pathUMS,"UMSMarker","Red",GMS_TMin_UMS,GMS_TMax_UMS,GMS_numberUnderwaterDynamicMissions] call GMS_fnc_addMissionToQue; }; }; -#ifdef GRGserver -["Running GhostriderGaming Version"] call GMS_fnc_log; + if (GMS_enableScoutsMissions > 0) then { [_missionListScouts,_pathScouts,"ScoutsMarker","red",GMS_TMin_Scouts,GMS_TMax_Scouts,GMS_enableScoutsMissions] call GMS_fnc_addMissionToQue; @@ -197,7 +196,38 @@ if (GMS_maxCrashSites > 0) then { [] execVM "\GMS\Missions\HeliCrashs\Crashes2.sqf"; }; -#endif + +diag_log format ["_init: Evaluating Static Missions"]; +if (GMS_enableStaticMissions > 0) then // GMS_enableStaticMissions should be an integer between 1 and N +{ + //diag_log format["fn_init: _pathStatics = %1",_pathStatics]; + //diag_log format["fn_init: _missionListStatics = %1",_missionListStatics]; + private _staticsToSpawn = []; + private _isStatic = true; + for "_i" from 1 to GMS_enableStaticMissions do + { + if (_i > (count _missionListStatics)) exitWith {}; + private _mission = selectRandom _missionLIstStatics; + //diag_log format["_init: static _mission selected = %1",_mission]; + _staticsToSpawn pushBack _mission; + _missionLIstStatics deleteAt (_missionLIstStatics find _mission); + //diag_log format["_init: _missionListStatics truncated to %1",_missionListStatics]; + }; + /* + params[ + ["_missionList",[]], + ["_path",""], + ["_marker",""], + ["_difficulty","Red"], + ["_tMin",60], + ["_tMax",120], + ["_noMissions",1], + ["_isStatic",false]]; + */ + //diag_log format["_init: _staticsToSpawn = %1:", _staticsToSpawn]; + [_staticsToSpawn,_pathStatics,"StaticsMarker","orange",GMS_TMin_Statics,GMS_TMax_Statics,GMS_enableStaticMissions,_isStatic] call GMS_fnc_addMissionToQue; + ["_init (229): Returned from _addMissionToQue"] call GMS_fnc_log; +}; // start the main thread for the mission system which monitors missions running and stuff to be cleaned up [] spawn GMS_fnc_mainThread; diff --git a/@GMS/addons/GMS/Configs/GMS_configs.sqf b/@GMS/addons/GMS/Configs/GMS_configs.sqf index ba5bdcc..75e32dd 100644 --- a/@GMS/addons/GMS/Configs/GMS_configs.sqf +++ b/@GMS/addons/GMS/Configs/GMS_configs.sqf @@ -161,7 +161,7 @@ switch (GMSCore_modType) do GMS_spawnCratesTiming = "atMissionSpawnGround"; // Choices: "atMissionSpawnGround","atMissionSpawnAir","atMissionEndGround","atMissionEndAir". // Crates spawned in the air will be spawned at mission center or the position(s) defined in the mission file and dropped under a parachute. // This sets the default value but can be overridden by defining _spawnCrateTiming in the file defining a particular mission. - GMS_loadCratesTiming = "atMissionCompletion"; //""atMissionSpawn"; // valid choices are "atMissionCompletion" and "atMissionSpawn"; + GMS_loadCratesTiming = "atMissionCompletion"; //"atMissionSpawn"; // valid choices are "atMissionCompletion" and "atMissionSpawn"; // Pertains only to crates spawned at mission spawn. // This sets the default but can be overridden for specific missions by defining _loadCratesTiming @@ -170,7 +170,7 @@ switch (GMSCore_modType) do // To spawn crates at mission start but load gear only after the mission is completed set GMS_spawnCratesTiming = "atMissionSpawnGround" && GMS_loadCratesTiming = "atMissionCompletion" // To spawn crates on the ground at mission completion set GMS_spawnCratesTiming = "atMissionEndGround" // Note that a loaded crate will be spawned. // To spawn crates in the air and drop them by chutes set GMS_spawnCratesTiming = "atMissionEndAir" // Note that a loaded crate will be spawned. - GMS_allowClaimVehicle = true; // Set this to true if you wish to allow players to claim vehicles using one of the claim vehicle scripts floating around. + GMS_allowClaimVehicle = false; // Set this to true if you wish to allow players to claim vehicles using one of the claim vehicle scripts floating around. /////////////////////////////// // PLAYER PENALTIES @@ -267,13 +267,11 @@ switch (GMSCore_modType) do // Heli Patrol Settings /////////////////////////////// - GMS_chanceHeliPatrolBlue = 0.5; //[0 - 1] Set to 0 to deactivate and 1 to always have a heli spawn over the mission center and patrol the mission area. - // The chance of paratroops dropping from the heli is defined by GMS_chancePara(Blue|Red|Green|Orange) above. - // Recommend setting the change = 1 if you wish to spawn multiple helis at a mission. - GMS_patrolHelisBlue = _GMS_littleBirds; - GMS_noPatrolHelisBlue = 1; + GMS_chanceHeliPatrolBlue = 1.0; //[0 - 1] The chance a heli will be spawned + GMS_patrolHelisBlue = _GMS_littleBirds; // The default helis + GMS_noPatrolHelisBlue = 1; // The default number of helis - GMS_chanceHeliPatrolRed = 0.75; // 0.4; + GMS_chanceHeliPatrolRed = 1.0; // 0.4; GMS_patrolHelisRed = _GMS_littleBirds; GMS_noPatrolHelisRed = 1; @@ -293,11 +291,14 @@ switch (GMSCore_modType) do GMS_maxSpawnedMissions = 15; //Set to -1 to disable. Values of 2 or more force the mission spawner to spawn copies of that mission - this feature is not recommended because you may run out of available groups. - GMS_enableOrangeMissions = 1; - GMS_enableGreenMissions = 2; - GMS_enableRedMissions = 2; - 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_enableOrangeMissions = -1; + GMS_enableGreenMissions = -2; + GMS_enableRedMissions = -2; + GMS_enableBlueMissions = -1; + GMS_numberUnderwaterDynamicMissions = -1; // Values from -1 (no UMS) to N (N Underwater missions will be spawned; static UMS units and subs will be spawned. + + // sets the maximum number of static missions to spawn - set to -1 to disable spawning them. + GMS_enableStaticMissions = 3; #ifdef GRGserver GMS_enableHunterMissions = 1; @@ -315,7 +316,8 @@ switch (GMSCore_modType) do GMS_TMin_Blue = 300; GMS_TMin_Red = 360; GMS_TMin_UMS = 300; - + GMS_TMin_Statics = 60 * 35; // minimum time for RESPAWN of static missions + #ifdef GRGserver GMS_TMin_Hunter = 340; GMS_TMin_Scouts = 300; @@ -328,6 +330,9 @@ switch (GMSCore_modType) do GMS_TMax_Blue = 360; GMS_TMax_Red = 420; GMS_TMax_UMS = 400; + GMS_TMax_Statics = GMS_TMin_Statics + 60; // Maximum time for RESAPWN of static missions + // Be sure the minimum is > than the time at which objects from the previous instance of a static mission are deleted + // That is set in GMS_cleanupCompositionTimer #ifdef GRGserver GMS_TMax_Hunter = 400; @@ -335,6 +340,7 @@ switch (GMSCore_modType) do GMS_TMax_Crashes = 360; #endif + // /////////////////////////////// // AI VEHICLE PATROL PARAMETERS /////////////////////////////// diff --git a/@GMS/addons/GMS/Missions/GMS_missionLists.sqf b/@GMS/addons/GMS/Missions/GMS_missionLists.sqf index 1555bd8..030801f 100644 --- a/@GMS/addons/GMS/Missions/GMS_missionLists.sqf +++ b/@GMS/addons/GMS/Missions/GMS_missionLists.sqf @@ -101,6 +101,15 @@ private _missionListOrange = [/*"default","default2","medicalCamp","redCamp","re /*,"temple"*/ ]; +private _pathStatics = "Statics"; +private _missionListStatics = [ + /// The format for these is filename + /// Do NOT include the extension here. + /// You will need to add the mission files to the statics folder. + "saltflatsone" + +]; + private _pathUMS = "UMS\dynamicMissions"; private _missionListUMS = ["default"]; diff --git a/@GMS/addons/GMS/Missions/Statics/saltflatsone.sqf b/@GMS/addons/GMS/Missions/Statics/saltflatsone.sqf new file mode 100644 index 0000000..162a185 --- /dev/null +++ b/@GMS/addons/GMS/Missions/Statics/saltflatsone.sqf @@ -0,0 +1,153 @@ + + +/* + Dynamic Mission Generated + Using 3DEN Plugin for GMS by Ghostrider + GMS 3DEN Plugin Version 1.1 : Build 16 : Build Date 09/23/23 + By Ghostrider-GRG- +*/ + +#include "\GMS\Compiles\Init\GMS_defines.hpp" +#include "\GMS\Missions\GMS_privateVars.sqf" + +_defaultMissionLocations = [[22815.9,17109.1,-2.7895e-005]]; +_maxMissionRespawns = -1; // Chage this to either zero for no respawns or a positive number if you want to limit the number of times a mission spawns at the same location +_markerLabel = ""; +_markerType = ["ELLIPSE",[150,150],"GRID"]; +_markerColor = ""; +_markerMissionName = "TODO: Set this to an appropriate name"; +_startMsg = "TODO: Change approiately"; +_endMsg = "TODO: Change Appropriately"; +_markerMissionName = ""; +_crateLoot = GMS_BoxLoot_Blue; +_lootCounts = GMS_lootCountsBlue; + +_garrisonedBuilding_ATLsystem = [ + +]; + +/* + Dynamic Mission Generated + Using 3DEN Plugin for GMS by Ghostrider + GMS 3DEN Plugin Version 1.1 : Build 16 : Build Date 09/23/23 + By Ghostrider-GRG- +*/ + +#include "\GMS\Compiles\Init\GMS_defines.hpp" +#include "\GMS\Missions\GMS_privateVars.sqf" + +_difficulty = "Blue"; +_chanceMissionSpawned = 1; +_defaultMissionLocations = [[22815.9,17109.1,-2.7895e-005]]; +_maxMissionRespawns = -1; // Chage this to either zero for no respawns or a positive number if you want to limit the number of times a mission spawns at the same location +_markerLabel = ""; +_markerType = ["ELLIPSE",[50,50],"FDiagonal"]; +_markerColor = "ColorWEST"; +_markerMissionName = "TODO: Set this to an appropriate name"; +_startMsg = "TODO: Change approiately"; +_endMsg = "TODO: Change Appropriately"; +_markerMissionName = ""; +_crateLoot = GMS_BoxLoot_Blue; +_lootCounts = GMS_lootCountsBlue; + +/* + Dynamic Mission Generated + Using 3DEN Plugin for GMS by Ghostrider + GMS 3DEN Plugin Version 1.1 : Build 16 : Build Date 09/23/23 + By Ghostrider-GRG- +*/ + +#include "\GMS\Compiles\Init\GMS_defines.hpp" +#include "\GMS\Missions\GMS_privateVars.sqf" + +_difficulty = "Blue"; +_chanceMissionSpawned = 1; +_defaultMissionLocations = [[22815.9,17109.1,-2.7895e-005]]; +_maxMissionRespawns = -1; // Chage this to either zero for no respawns or a positive number if you want to limit the number of times a mission spawns at the same location +_markerLabel = "any"; +_markerType = ["ELLIPSE",[50,50],"FDiagonal"]; +_markerColor = "ColorWEST"; +_markerMissionName = "TODO: Set this to an appropriate name"; +_startMsg = "TODO: Change approiately"; +_endMsg = "TODO: Change Appropriately"; +_markerMissionName = ""; +_crateLoot = GMS_BoxLoot_Blue; +_lootCounts = GMS_lootCountsBlue; + +_garrisonedBuilding_ATLsystem = [ + +]; + +_missionLandscape = [ + ["RoadCone_L_F",[-0.00390625,-0.0507813,0.00721931],0,[true,true]], + ["Land_MedicalTent_01_aaf_generic_closed_F",[31.8184,17.293,0.0235131],0,[true,true]], + ["Land_Research_HQ_F",[17.0625,-18.8281,-0.000879765],0,[true,true]], + ["Land_BagBunker_Large_F",[-28.8945,-16.3652,0.0173037],0,[true,true]] +]; + +_simpleObjects = [ + +]; + +_missionLootVehicles = [ + +]; + +_missionPatrolVehicles = [ + ["B_MRAP_01_F",[-4.84375,-26.1211,0.000152349],0] +]; + +_submarinePatrolParameters = [ + +]; + +_airPatrols = [ + ["B_Heli_Light_01_dynamicLoadout_F",[50.4258,2.28125,0.000232935],0] +]; + +_missionEmplacedWeapons = [ + ["B_HMG_01_F",[-4.19727,-1.55469,0.01511],0] +]; + +_missionGroups = [ + +]; + +_scubaGroupParameters = [ + +]; + +_missionLootBoxes = [ + +]; + +/* + Use the parameters below to customize your mission - see the template or blck_configs.sqf for details about each them +*/ +_chanceHeliPatrol = 0; +_noChoppers = 1; +_missionHelis = GMS_patrolHelisBlue; +_chancePara = GMS_chanceParaBlue; +_noPara = 0; +_paraTriggerDistance = 400; +_chanceLoot = 0.0; +_paraLoot = GMS_BoxLoot_Blue; +_paraLootCounts = GMS_lootCountsBlue; +_missionLandscapeMode = "precise"; +_uniforms = GMS_SkinList; +_headgear = GMS_headgear; +_vests = GMS_vests; +_backpacks = GMS_backpacks; +_sideArms = GMS_Pistols; +_spawnCratesTiming = "atMissionEndGround"; +_loadCratesTiming = "atMissionCompletion"; +_endCondition = playerNear; +_minNoAI = 0; +_maxNoAI = 0; +_noAIGroups = 0; +_noVehiclePatrols = 1; +_noEmplacedWeapons = 1; +_submarinePatrols = 0; // Default number of submarine patrols at pirate missions +_scubaPatrols = 0; // Default number of scuba diver patrols at pirate missions + +#include "\GMS\Compiles\Missions\GMS_fnc_missionSpawner.sqf"; \ No newline at end of file diff --git a/@GMS/addons/GMS/changeLog.sqf b/@GMS/addons/GMS/changeLog.sqf index e7f6d8f..68bc5a0 100644 --- a/@GMS/addons/GMS/changeLog.sqf +++ b/@GMS/addons/GMS/changeLog.sqf @@ -36,6 +36,27 @@ Support for Static Missions was removed. Use the ability to spawn a mission at a I have kept the change log as a bit of history for those interested in development of this mission system. Significant Changes: +7.15 +1. Added control over what kill messages are displayed. +See the following settings in GMS_configs.sqf +GMSAI_killMessagingRadius = 3000; +GMS_killMessageToAllPlayers = [ ... ]; +GMS_killMessageTypesKiller = [ ... ]; + +2. Added an option to spawn static missions. +Deposit the .sqf files for these missions in Missions\Statics. +Add their names to _staticMissions = [ ... ]; in \Missions\GMS_missionLists.sqf +Static Missions are initialized (any objects and markers are spawned) beginiing at 60 seconds after server startup. +The number of static missions that spawn is set by GMS_enableStaticMissions. + If there are more missions listed in _staticMissions, then GMS_enableStaticMissions will be randomly selected and spawned at each server restart. + If there are fewer than GMS_enableStaticMissions missions in _staticMissions then just the missions in the list will be spawned. +Missions are cleared and responding like any dynamic mission. + +Set the timers for min and max in GMS_config.sqf + +3. Reworked some code for spawning missions to make the process more easily followed and increase efficiency by calling reather than spawniing _monitorInitializedMissions + and moving code in that function that must be spawned to a separate function. This should reduce the number of times a [] spawn operation is performed. + 7.11 Build 253 Changed format for skills to be compatible with GMS_fnc_skills from GMSCore Changed to code for spawning and configuring units in groups to that from GMSCore diff --git a/@GMS/addons/GMS/config.cpp b/@GMS/addons/GMS/config.cpp index b2916cf..4a56f86 100644 --- a/@GMS/addons/GMS/config.cpp +++ b/@GMS/addons/GMS/config.cpp @@ -12,9 +12,9 @@ */ class GMSBuild { - Version = "7.144"; - Build = "262"; - Date = "09-16-2023"; + Version = "7.15"; + Build = "263"; + Date = "09-24-2023"; }; class CfgPatches { @@ -108,6 +108,7 @@ class CfgFunctions { class spawnCrate {}; class spawnCompositionObjects {}; class spawnEmplacedWeaponArray {}; + class spawnMissionAssets {}; class spawnMines {}; class spawnMissionAI {}; class spawnMissionCrates {}; diff --git a/@GMS_3EDEN/addons/3DEN_plugin.pbo b/@GMS_3EDEN/addons/3DEN_plugin.pbo index bd710dd..9efded2 100644 Binary files a/@GMS_3EDEN/addons/3DEN_plugin.pbo and b/@GMS_3EDEN/addons/3DEN_plugin.pbo differ diff --git a/@GMS_3EDEN/addons/3DEN_plugin/Core/fn_buildingContainer copy.sqf b/@GMS_3EDEN/addons/3DEN_plugin/Core/fn_buildingContainer copy.sqf deleted file mode 100644 index e15af7a..0000000 --- a/@GMS_3EDEN/addons/3DEN_plugin/Core/fn_buildingContainer copy.sqf +++ /dev/null @@ -1,23 +0,0 @@ -/* - Returns the builing containing an object or objNull - By Ghostrider-GRG- - Copyright 2020 -*/ - -params["_u",["_category","House"]]; -private _pos = getPosASL _u; -private _building = objNull; -private _surfacesAbove = lineInterSectsSurfaces [_pos, [_pos select 0, _pos select 1, (_pos select 2) + 100],_u,_u,true,10]; - -{ - if ((_x select 2) isKindOf _category && !(_x isEqualTo _u)) exitWith {_building = (_x select 2)}; -} forEach _surfacesAbove; -if (_building isEqualTo objNull) then -{ - private _surfacesBelow = lineInterSectsSurfaces [_pos, [_pos select 0, _pos select 1, (_pos select 2) - 10],_u,_u,true,100]; - { - if ((_x select 2) isKindOf _category && !(_x isEqualTo _u)) exitWith {_building = (_x select 2)}; - } forEach _surfacesBelow; -}; - -_building \ No newline at end of file diff --git a/@GMS_3EDEN/addons/3DEN_plugin/Core/fn_exportDynamic.sqf b/@GMS_3EDEN/addons/3DEN_plugin/Core/fn_exportDynamic.sqf index 8c734e5..2a26d5e 100644 --- a/@GMS_3EDEN/addons/3DEN_plugin/Core/fn_exportDynamic.sqf +++ b/@GMS_3EDEN/addons/3DEN_plugin/Core/fn_exportDynamic.sqf @@ -118,27 +118,32 @@ if !(isNull _centerMarkerObject) then diag_log format["Place such an object or a marker to ensure the mission is accurately stored and spawned"]; }; -private["_m1","_markerPos","_markerType","_markerShape","_markerColor","_markerText","_markerBrush","_markerSize","_markerAlpha"]; +private["_m1","_markerPos","_markerType","_markerShape","_markerColor","_markerText","_markerBrush","_markerSize","_markerAlpha","_markerLabel"]; /* pull info on the first marker found If Mission_CENTER was not set above then try to set it based on the first marker identified. */ -if (_markers isEqualTo []) then +private _centerSet = false; +if !(_markers isEqualTo []) then { - diag_log "No Marker Found, no Marker Definitions Will Be generated"; -} else { private _m1 = _markers select 0; _markerPosition = (_m1 get3DENAttribute "Position") select 0; // Returns expected value _markerText = (_m1 get3DENAttribute "Text") select 0; // Returns expected value _markerColor = (_m1 get3DENAttribute "baseColor") select 0; //Returns Null - _markerShape = (_m1 get3DENAttribute "markerType") select 0; // Returns [-1] if not a rectangular or elipsoid marker] + _markerShape = ((_m1 get3DENAttribute "markerType") select 0); // Returns [-1] if not a rectangular or elipsoid marker] _markerAlpha = _m1 get3DENAttribute "alpha"; _markerType = (_m1 get3DENAttribute "itemClass") select 0; // Returns "" if not an icon type marker _markerBrush = (_m1 get3DENAttribute "brush") select 0; _markerSize = (_m1 get3DENAttribute "size2") select 0; _markerRotation = (_m1 get3DENAttribute "rotation") select 0; - + diag_log format["Line 140: _markerShape = %1 | _markerType = %2 _m1 get3DENAttribute markerType = %3",_markerShape,_markerType, _m1 get3DENAttribute "markerType"]; + switch (_markerShape) do + { + case -1: {}; + case 0:{_markerType = "RECTANGLE"}; + case 1: {_markerType = "ELLIPSE"}; + }; /* use the coordinates of that marker as mission center of no object demarkating the center is found */ @@ -152,6 +157,28 @@ if (_markers isEqualTo []) then }; }; +if (Mission_CENTER isEqualTo [0,0,0]) then { + Mission_CENTER = position (_objects select 0); + diag_log format[" Mission Center set to the position of the first object"]; +}; + +if (_markers isEqualTo []) then +{ + _markerPosition = Mission_CENTER; + _markerLabel = ""; + _markerText = ""; + _markerColor = ""; + _markerShape = "ELLIPSE"; + _markerAlpha = 1.0; + _markerType = _markerShape; + _markerBrush = "GRID"; + _markerSize = [150,150]; + _markerRotation = 0; +}; + +private _markerMissionName = "TODO: Set this to an appropriate name"; + +diag_log format["Line 175: _markerType = %1",_markerType]; private _m = format["Line 152: Mission_CENTER = %1",Mission_CENTER]; systemChat _m; diag_log _m; @@ -252,7 +279,15 @@ GMS_missionSimpleObjects = []; /* Treat this like an ordinary building */ - GMS_objectsToSpawn pushBack format[' ["%1",%2,%3]',typeOf _obj,(getPosATL _obj) vectorDiff Mission_CENTER,getDir _obj]; + private _allowDamage = (_obj get3DENAttribute "allowDamage") select 0; + private _enableSimulation = (_obj get3DENAttribute "enableSimulation") select 0; + diag_log format["_Line 278: _building %1 | _allowDamage %2 | _enableSimulation %3",_obj,_allowDamage,_enableSimulation] ; + GMS_objectsToSpawn pushBack format[' ["%1",%2,%3,[%4,%5]]', + typeOf _obj, + (getPosATL _obj) vectorDiff Mission_CENTER,getDir _obj, + _allowDamage, + _enableSimulation + ]; } else { /* Treat this like a garrisoned building @@ -356,15 +391,15 @@ switch (GMS_missionLocations) do _lines pushBack '#include "\GMS\Compiles\Init\GMS_defines.hpp"'; _lines pushBack '#include "\GMS\Missions\GMS_privateVars.sqf" '; _lines pushBack ""; +_lines pushBack format['_difficulty = "%1";',GMS_difficulty]; +_lines pushBack format["_chanceMissionSpawned = %1;",GMS_chanceMissionSpawned]; _lines pushBack format["_defaultMissionLocations = %1;",GMS_defaultMissionLocations]; _lines pushBack format["_maxMissionRespawns = -1; // Chage this to either zero for no respawns or a positive number if you want to limit the number of times a mission spawns at the same location"]; -if (_markerType isEqualTo "") then -{ - _markerType = ["rectangle","elipse"] select _markerShape; -}; -_lines pushBack format["_markerType = %1",format['["%1",%2,"%3"];',_markerType,_markerSize,_markerBrush]]; +_lines pushBack format['_markerLabel = "%1";',_markerLabel]; +_lines pushBack format['_markerType = %1;',[_markerType,_markerSize,_markerBrush]]; _lines pushBack format['_markerColor = "%1";',_markerColor]; +_lines pushBack format['_markerMissionName = "%1";',_markerMissionName]; _lines pushBack format['_startMsg = "%1";',GMS_dynamicStartMessage]; _lines pushBack format['_endMsg = "%1";',GMS_dynamicEndMessage]; @@ -436,8 +471,8 @@ _lines pushBack "_headgear = GMS_headgear;"; _lines pushBack "_vests = GMS_vests;"; _lines pushBack "_backpacks = GMS_backpacks;"; _lines pushBack "_sideArms = GMS_Pistols;"; -_lines pushBack format['_spawnCratesTiming = "%1";',GMS_spawnCratesTiming]; -_lines pushBack format['_loadCratesTiming = "%1";',GMS_loadCratesTiming]; +_lines pushBack format['_spawnCratesTiming = "%1;"',GMS_spawnCratesTiming]; +_lines pushBack format['_loadCratesTiming = "%1;"',GMS_loadCratesTiming]; diag_log format["Line 520: typeName GMS_missionEndCondition = %1 | GMS_missionEndCondition = = %2",typeName GMS_missionEndCondition,GMS_missionEndCondition]; _lines pushBack format['_endCondition = %1;', GMS_missionEndCondition]; _lines pushBack format["_minNoAI = GMS_MinAI_%1;",GMS_difficulty]; diff --git a/@GMS_3EDEN/addons/3DEN_plugin/Core/fn_garrisonApplyChanges.sqf b/@GMS_3EDEN/addons/3DEN_plugin/Core/fn_garrisonApplyChanges.sqf new file mode 100644 index 0000000..e1eda25 --- /dev/null +++ b/@GMS_3EDEN/addons/3DEN_plugin/Core/fn_garrisonApplyChanges.sqf @@ -0,0 +1,3 @@ + +params["_entity","_value","_property"]; +diag_log format["garrisonApplyChanges: _entity %1 | _value %2 | _property %3",_entity,_value,_property]; \ No newline at end of file diff --git a/@GMS_3EDEN/addons/3DEN_plugin/Core/fn_initializeAttributes.sqf b/@GMS_3EDEN/addons/3DEN_plugin/Core/fn_initializeAttributes.sqf index b08aed8..7e3a4c6 100644 --- a/@GMS_3EDEN/addons/3DEN_plugin/Core/fn_initializeAttributes.sqf +++ b/@GMS_3EDEN/addons/3DEN_plugin/Core/fn_initializeAttributes.sqf @@ -7,6 +7,8 @@ GMS_difficulty = getText(configFile >> "CfgGMS3DEN" >> "CfgDefaults" >> "defaultMissionDifficulty"); diag_log format["configs returned defaultMissionDifficulty = %1",GMS_difficulty]; +GMS_chanceMissionSpawned = 1.0; +diag_log format["GMS_chanceMissionSpawned set to default setting of 100%"]; GMS_lootcrateSpawnTiming = getText(configFile >> "CfgGMS3DEN" >> "CfgDefaults" >> "defaultLootcrateSpawnTiming"); diag_log format["configs returned defaultLootcrateSpawnTiming = %1",GMS_lootcrateSpawnTiming]; GMS_lootcrateLoadTiming = getText(configFile >> "CfgGMS3DEN" >> "CfgDefaults" >> "defaultLootcrateLoadTiming"); diff --git a/@GMS_3EDEN/addons/3DEN_plugin/Core/fn_onAttributeLoadGarrison.sqf b/@GMS_3EDEN/addons/3DEN_plugin/Core/fn_onAttributeLoadGarrison.sqf index 986a0c9..7fbfc10 100644 --- a/@GMS_3EDEN/addons/3DEN_plugin/Core/fn_onAttributeLoadGarrison.sqf +++ b/@GMS_3EDEN/addons/3DEN_plugin/Core/fn_onAttributeLoadGarrison.sqf @@ -1,4 +1,4 @@ -params["_control","_value"]; -diag_log format["_onAttributeLoadGarrisons: _control = %1 | _value = %2",_control,_value]; +params["_control","_value","_config"]; +diag_log format["_onAttributeLoadGarrisons: _control = %1 | _value = %2 | _config %3",_control,_value,_config]; diff --git a/@GMS_3EDEN/addons/3DEN_plugin/Core/fn_onAttributeLoadLootVeh.sqf b/@GMS_3EDEN/addons/3DEN_plugin/Core/fn_onAttributeLoadLootVeh.sqf index a4158e6..31b49d1 100644 --- a/@GMS_3EDEN/addons/3DEN_plugin/Core/fn_onAttributeLoadLootVeh.sqf +++ b/@GMS_3EDEN/addons/3DEN_plugin/Core/fn_onAttributeLoadLootVeh.sqf @@ -1,4 +1,4 @@ -params["_control","_value"]; -diag_log format["_onLoadAttributeLoadLootVeh: _control = %1 | _value = %2",_control,_value]; \ No newline at end of file +params["_cbChecked"]; +diag_log format["_onLoadAttributeLoadLootVeh: _cbChecked = %1 ",_cbChecked]; \ No newline at end of file diff --git a/@GMS_3EDEN/addons/3DEN_plugin/Core/fn_onAttributeSaveGarrison.sqf b/@GMS_3EDEN/addons/3DEN_plugin/Core/fn_onAttributeSaveGarrison.sqf index d2669b2..95abd37 100644 --- a/@GMS_3EDEN/addons/3DEN_plugin/Core/fn_onAttributeSaveGarrison.sqf +++ b/@GMS_3EDEN/addons/3DEN_plugin/Core/fn_onAttributeSaveGarrison.sqf @@ -1,10 +1,10 @@ -params["_isGarrison"]; +params["_control"]; private _isGarrison; private _selectedObjects = get3DENSelected "object"; -diag_log format["onAttributeSaveGarrison: _isGarrison %1 | _selectedObjects %2",_isGarrison,_selectedObjects]; +diag_log format["onAttributeSaveGarrison: _isGarrison %1 | _selectedObjects %2",_control,_selectedObjects]; if (count _selecteObjects == 1) then { private _object = _selectedObjects select 0; - private _isGarrison = _object getVariable["gmsIsGarrison",false]; - _object setVariable["gmsIsGarrison",_isGarrison]; + //private _isGarrison = _object getVariable["gmsIsGarrison",false]; + //_object setVariable["gmsIsGarrison",_isGarrison]; }; \ No newline at end of file diff --git a/@GMS_3EDEN/addons/3DEN_plugin/Core/fn_onAttributeSaveLootVeh.sqf b/@GMS_3EDEN/addons/3DEN_plugin/Core/fn_onAttributeSaveLootVeh.sqf index 6931fa5..a447d62 100644 --- a/@GMS_3EDEN/addons/3DEN_plugin/Core/fn_onAttributeSaveLootVeh.sqf +++ b/@GMS_3EDEN/addons/3DEN_plugin/Core/fn_onAttributeSaveLootVeh.sqf @@ -1,12 +1,4 @@ -params["_control"]; -private _isLootVeh = ctrlChecked _control; -private _selectedObjects = get3DENSelected "object"; -diag_log format["onAttributeSaveLootVeh: _control %1 | _isGarrison %2 | _selectedObjects %3",_control,_isLootVeh,_selectedObjects]; -if (count _selecteObjects == 1) then { - private _object = _selectedObjects select 0; - _object setVariable["gmsIsLootVehicle",_isLootVeh]; -} else { - ["Changes not applied: you can only configure one object at a time","ERROR"] call BIS_fnc_3DENShowMessage; -}; +params["_cbChecked"]; +diag_log format["_onLoadAttributeLoadLootVeh: _cbChecked = %1 ",_cbChecked]; diff --git a/@GMS_3EDEN/addons/3DEN_plugin/Core/fn_onLoadGarrison.sqf b/@GMS_3EDEN/addons/3DEN_plugin/Core/fn_onLoadGarrison.sqf index 0345382..452354f 100644 --- a/@GMS_3EDEN/addons/3DEN_plugin/Core/fn_onLoadGarrison.sqf +++ b/@GMS_3EDEN/addons/3DEN_plugin/Core/fn_onLoadGarrison.sqf @@ -16,7 +16,7 @@ This means that during the onLoad event of the upper controls the lower controls params ["_displayOrControl", ["_config", configNull]]; private _selectedObjects = get3DENSelected "object"; diag_log format["onLoadGarrison: _selectedObjects = %1",_selectedObjects]; - +diag_log format["onLoadGarrison: _displayControl = %1 | _config = %2",_displayOrControl,_config]; private "_isGarrison"; if (count _selectedObjects == 1) then { private _object = (_selectedObjects select 0); @@ -25,7 +25,7 @@ if (count _selectedObjects == 1) then { diag_log format["_isGarrisson = %1 | _obj = %2",_isGarrison,_object]; } else { _displayOrControl cbSetChecked false; - ["You can configure Garrison Status for only ONE vehicle at a time","ERROR"] call BIS_fnc_3DENShowMessage; + ["You can configure Garrison Status for only ONE vehicle at a time","ERROR"] call BIS_fnc_3DENShowMessage; }; diff --git a/@GMS_3EDEN/addons/3DEN_plugin/Core/fn_onLoadLootVeh.sqf b/@GMS_3EDEN/addons/3DEN_plugin/Core/fn_onLoadLootVeh.sqf index cba5f48..555dd09 100644 --- a/@GMS_3EDEN/addons/3DEN_plugin/Core/fn_onLoadLootVeh.sqf +++ b/@GMS_3EDEN/addons/3DEN_plugin/Core/fn_onLoadLootVeh.sqf @@ -3,10 +3,6 @@ params ["_displayOrControl", ["_config", configNull]]; private _selectedObjects = get3DENSelected "object"; -if (count _objects == 1) then -{ - _displayOrControl cbSetChecked ((_objects select 0) getVariable["gmsIsLootVehicle",false]); -} else { - _displayOrControl cbSetChecked false; +if !(count _objects > 1) then { ["You can configure Loot Vehicle Status for only ONE vehicle at a time","ERROR"] call BIS_fnc_3DENShowMessage; }; diff --git a/@GMS_3EDEN/addons/3DEN_plugin/Core/fn_onLoadLootVehColor.sqf b/@GMS_3EDEN/addons/3DEN_plugin/Core/fn_onLoadLootVehColor.sqf index 7381b22..925c6da 100644 --- a/@GMS_3EDEN/addons/3DEN_plugin/Core/fn_onLoadLootVehColor.sqf +++ b/@GMS_3EDEN/addons/3DEN_plugin/Core/fn_onLoadLootVehColor.sqf @@ -3,10 +3,6 @@ params ["_displayOrControl", ["_config", configNull]]; private _selectedObjects = get3DENSelected "object"; -if (count _objects == 1) then -{ - _displayOrControl cbSetChecked ((_objects select 0) getVariable["gmsLootVehicleColor",false]); -} else { - _displayOrControl cbSetChecked false; +if !(count _objects > 1) then { ["You can configure Loot Vehicle Status for only ONE vehicle at a time","ERROR"] call BIS_fnc_3DENShowMessage; }; \ No newline at end of file diff --git a/@GMS_3EDEN/addons/3DEN_plugin/Core/fn_onAttributeSaveLootVehColor.sqf b/@GMS_3EDEN/addons/3DEN_plugin/Core/fn_setLootVehColor.sqf similarity index 85% rename from @GMS_3EDEN/addons/3DEN_plugin/Core/fn_onAttributeSaveLootVehColor.sqf rename to @GMS_3EDEN/addons/3DEN_plugin/Core/fn_setLootVehColor.sqf index ea7183e..393b0b8 100644 --- a/@GMS_3EDEN/addons/3DEN_plugin/Core/fn_onAttributeSaveLootVehColor.sqf +++ b/@GMS_3EDEN/addons/3DEN_plugin/Core/fn_setLootVehColor.sqf @@ -1,13 +1,12 @@ -params["_control"]; -private _isColorOn = ctrlChecked _control; +params["_checked"]; private _selectedObjects = get3DENSelected "object"; diag_log format["onAttributeSaveLootVehColor: _control %1 | _isGarrison %2 | _selectedObjects %3",_control,_isColorOn,_selectedObjects]; if (count _selecteObjects == 1) then { private _object = _selectedObjects select 0; private _isLootVeh = _object getVariable["gmsIsLootVehicle",false]; _object setVariable["gmsLootVehicleColor",_isColorOn]; - if (_isColor && gmsIsLootVehicle) then { + if (_checked && _isLootVeh) then { {_object setObjectTexture [_x,gms3DENlootVehicleTexture]} forEach (count (getObjectTextures _object)); } else { {_object setObjectTexture [_x,""]} forEach (count (getObjectTextures _object)); diff --git a/@GMS_3EDEN/addons/3DEN_plugin/Core/fn_setMaxAI.sqf b/@GMS_3EDEN/addons/3DEN_plugin/Core/fn_setMaxAI.sqf new file mode 100644 index 0000000..fd881e8 --- /dev/null +++ b/@GMS_3EDEN/addons/3DEN_plugin/Core/fn_setMaxAI.sqf @@ -0,0 +1,18 @@ +/* + GMS 3EDEN Editor Plugin + by Ghostrider-GRG- + Copyright 2020 + + sets a variable that specifies the maximum number of AI that will be spawned for each infantry group. + this variable is read when the mission is exported and saved in the configuration for each mission Infantry Group. +*/ + +params["_maxAI"]; +if (_maxAI < GMS_minAI) exitWith { + private _m = format["Invalid selection - MinAI set to %1. Max AI must be greater than or equal to min AI",GMS_minAI]; + systemChat _m; + diag_log _m; + [_m, "ERROR"] call BIS_fnc_3DENShowMessage; +}; +GMS_maxAI = _maxAI; +diag_log format["_setMaxAI: GMS_maxAI set to %1",GMS_maxAI]; \ No newline at end of file diff --git a/@GMS_3EDEN/addons/3DEN_plugin/Core/fn_setMinAI.sqf b/@GMS_3EDEN/addons/3DEN_plugin/Core/fn_setMinAI.sqf new file mode 100644 index 0000000..ecfa622 --- /dev/null +++ b/@GMS_3EDEN/addons/3DEN_plugin/Core/fn_setMinAI.sqf @@ -0,0 +1,18 @@ +/* + GMS 3EDEN Editor Plugin + by Ghostrider-GRG- + Copyright 2020 + + sets a variable that specifies the minimum number of AI that will be spawned for each infantry group. + this variable is read when the mission is exported and saved in the configuration for each missionInfantryGroup. +*/ + +params["_minAI"]; +if (_minAI > GMS_maxAI) exitWith { + private _m = format["Invalid selection - MaxAI set to %1. Min AI must be less than or equal to max AI",GMS_maxAI]; + systemChat _m; + diag_log _m; + [_m, "ERROR"] call BIS_fnc_3DENShowMessage; +}; +GMS_minAI = _minAI; +diag_log format["_setMinAI: GMS_minAI set to %1",GMS_minAI]; \ No newline at end of file diff --git a/@GMS_3EDEN/addons/3DEN_plugin/Core/fn_setSpawnChance.sqf b/@GMS_3EDEN/addons/3DEN_plugin/Core/fn_setSpawnChance.sqf new file mode 100644 index 0000000..7c805f2 --- /dev/null +++ b/@GMS_3EDEN/addons/3DEN_plugin/Core/fn_setSpawnChance.sqf @@ -0,0 +1,11 @@ +/* + GMS 3EDEN Editor Plugin + by Ghostrider-GRG- + Copyright 2020 + + sets a variable that specifies the chance that a mission will be spawned. + this variable is read when the mission is exported and saved in _chanceMissionSpawned. +*/ +params["_chance"]; +GMS_chanceMissionSpawned = _chance; +diag_log format["_setSpawnChance: GMS_chanceMissionSpawned set to %1",GMS_chanceMissionSpawned]; \ No newline at end of file diff --git a/@GMS_3EDEN/addons/3DEN_plugin/Static/scanAttributes.sqf b/@GMS_3EDEN/addons/3DEN_plugin/Static/scanAttributes.sqf new file mode 100644 index 0000000..1530fcd --- /dev/null +++ b/@GMS_3EDEN/addons/3DEN_plugin/Static/scanAttributes.sqf @@ -0,0 +1,9 @@ + + +all3DENEntities params ["_objects"]; +{ + private _garrison = _x getVariable["gmsIsGarrison",false]; + _m = format["scanAttributes: object %1 | displayName %2 | _garrison %3",_x, getText(configFile >> "CfgVehicles" >> typeOf _x >> "displayName"), _garrison]; + systemChat _m; + diag_log _m; +} forEach _objects; \ No newline at end of file diff --git a/@GMS_3EDEN/addons/3DEN_plugin/changlog.txt b/@GMS_3EDEN/addons/3DEN_plugin/changlog.txt new file mode 100644 index 0000000..628db0c --- /dev/null +++ b/@GMS_3EDEN/addons/3DEN_plugin/changlog.txt @@ -0,0 +1,8 @@ + + + +Long-term TODO: + + + + diff --git a/@GMS_3EDEN/addons/3DEN_plugin/config.cpp b/@GMS_3EDEN/addons/3DEN_plugin/config.cpp index 342075f..5712995 100644 --- a/@GMS_3EDEN/addons/3DEN_plugin/config.cpp +++ b/@GMS_3EDEN/addons/3DEN_plugin/config.cpp @@ -12,7 +12,6 @@ #include "gmsCfgFunctions.h" #include "gmsCfg3DENVersion.h" #include "gmsCfg3DENsettings.h" -//#include "settings.h" #include "gmsCfg3DEN.h" #include "gmsCfg3DENDisplay.h" diff --git a/@GMS_3EDEN/addons/3DEN_plugin/gmsCfg3DEN copy 2.h b/@GMS_3EDEN/addons/3DEN_plugin/gmsCfg3DEN copy 2.h new file mode 100644 index 0000000..3d452d1 --- /dev/null +++ b/@GMS_3EDEN/addons/3DEN_plugin/gmsCfg3DEN copy 2.h @@ -0,0 +1,56 @@ + + +class cfg3DEN +{ + class EventHandlers + { + class gms3DEN + { + OnMissionLoad = "diag_log format['Mission loaded at %1',diag_tickTime]; call gms3DEN_fnc_initialize"; + OnMissionNew = "diag_log format['New Mission Created at %1',diag_tickTime]; call gms3DEN_fnc_initialize"; + //onHistoryChange = "call gms3DEN_fnc_updateObjects"; + }; + }; + + class Attributes + { + class Default; + class Title: Default + { + class Controls + { + class Title; + }; + }; + class CheckBox: default{ + class Controls + { + class Title; + class Value; + }; + }; + }; + class Object + { + class AttributeCatories + { + class gmsAttributes + { + displayName = "GMS Settings"; + collapsed = 1; + class Attributes + { + class lootVehicle + { + displayName = "Loot Vehicle"; + toolTip = "Set as Loot Vehicle"; + property = "gmsLootVehicle"; + control = "CheckBox"; + defaultValue = "false"; + condition = "objectVehicle"; + }; + }; + }; + }; + }; +}; \ No newline at end of file diff --git a/@GMS_3EDEN/addons/3DEN_plugin/gmsCfg3DEN copy.h b/@GMS_3EDEN/addons/3DEN_plugin/gmsCfg3DEN copy.h new file mode 100644 index 0000000..9419608 --- /dev/null +++ b/@GMS_3EDEN/addons/3DEN_plugin/gmsCfg3DEN copy.h @@ -0,0 +1,149 @@ + + + +class cfg3DEN +{ + class EventHandlers + { + class gms3DEN + { + OnMissionLoad = "diag_log format['Mission loaded at %1',diag_tickTime]; call gms3DEN_fnc_initialize"; + OnMissionNew = "diag_log format['New Mission Created at %1',diag_tickTime]; call gms3DEN_fnc_initialize"; + //onHistoryChange = "call gms3DEN_fnc_updateObjects"; + }; + }; + class Mission + { + class gms3DENmissionSettings + { + displayName = "Mission Settings"; + // display = "Display3DENEditAttributesPreview"; // Optional - display for attributes window. Must have the same structure and IDCs as the default Display3DENEditAttributes + class AttributeCategories + { + class gms3DENCategory + { + class Attributes + { + class missionStartMessage + { + property = "gmsMissionStartMessage"; + }; + class missionEndMessage + { + property = "gmsMissionEndMessage"; + }; + class missionDifficulty + { + property = "gmsMissionDifficulty"; + }; + }; + }; + }; + }; + }; + class Attributes + { + class Default; + + class Title: Default + { + class Controls + { + class Title; + }; + }; + + class gms3DENCheckBoxGarrisonsControl: Title + { + onload = "call gms3DEN_fnc_onLoadGarrison;"; + onUnload = "diag_log 'onUnload for garrisons'"; + onCheckedChanged = "diag_log format['onCheckedChanged %1',_this];"; + attributeLoad = "(_this controlsGroupCtrl 100) ctrlSetText _value; [_this,_value] call gms3DEN_fnc_onAttributeLoadGarrison;"; + attributeSave = "[cbChecked (this controlsGroupCtrl 100)] call gms3DEN_fnc_onAttributeSaveGarrison;"; + }; + class gmsGarrisonColorControl: Title + { + onload = "call gms3DEN_fnc_onLoadGarrisonColor;"; + //onUnload = "diag_log 'onUnload for garrisons'"; + attributeLoad = "[_this,_value] call gms3DEN_fnc_onAttributeLoadGarrisonColor;"; + attributeSave = "[_this,_value] call gms3DEN_fnc_onAttributeSaveGarrisonColor;"; + }; + class gms3DENCheckboxLootVehControl: Title + { + onload = "call gms3DEN_fnc_onLoadLootVeh;"; + //onUnload = "diag_log 'onUnload for loot veh'"; + onAttributeLoad = "[_this,_value] call gms3DEN_fnc_onAttributeLoadLootVeh;"; + onAttributeSave = "[_this,_value] call gms3DEN_fnc_onAttributeSaveLootVeh;"; + }; + class gms3DENCLootVehicleColorControl: Title + { + onload = "call gms3DEN_fnc_onLoadLootVehColor;"; + //onUnload = "diag_log 'onUnload for loot veh'"; + onAttributeLoad = "[_this,_value] call gms3DEN_fnc_onAttributeLoadLootVehColor;"; + onAttributeSave = "[_this,_value] call gms3DEN_fnc_onAttributeSaveLootVeh;"; + }; + }; + + class Object + { + class AttributeCategories + { + class gms3DENgarrisonedAttribute + { + displayName = "Garrisons"; + collapsed = 1; + class Attributes + { + class GarrisonedAttribute + { + displayName = "Garrison"; + tooltip = "Mark as part of a garrison"; + property = "gmsIsGarrison"; + control = "gms3DENCheckBoxGarrisonsControl"; + //condition = ""; + expression = "_this setVariable ['%s',_value];"; + defaultValue = "false"; + }; + class GarrisonedColorAttribute + { + displayName = "Color On"; + tooltip = "Check to color this garrisoned object" + property = "gmsGarrisonColor"; + control = "CheckBox"; + //condition = ""; + expression = "_this setVariable ['%s',_value];"; + defaultValue = "false"; + }; + }; + }; + class gms3DENlootVehicles + { + displayName = "Loot Vehicle"; + collapsed = 1; + class Attributes + { + class lootVehicleAttribute + { + displayName = "Loot Vehicle"; + tooltip = "Set box to checked for loot vehicles"; + property = "gmsIsLootVehicle"; + control = "CheckBoz"; + //condition = ""; + expression = "_this setVariable ['%s',_value];"; + defaultValue = "false"; + }; + class lootVehicleColorAttribute + { + displayName = "Color On"; + tooltip = "Check box to color this loot vehicle"; + property = "gmsLootVehicleColor"; + control = "CheckBox"; + //condition = ""; + expression = "_this setVariable ['%s',_value];"; + defaultValue = "false"; + }; + }; + }; + }; + }; +}; \ No newline at end of file diff --git a/@GMS_3EDEN/addons/3DEN_plugin/gmsCfg3DEN.h b/@GMS_3EDEN/addons/3DEN_plugin/gmsCfg3DEN.h index b30ebc2..003844b 100644 --- a/@GMS_3EDEN/addons/3DEN_plugin/gmsCfg3DEN.h +++ b/@GMS_3EDEN/addons/3DEN_plugin/gmsCfg3DEN.h @@ -1,13 +1,6 @@ -class Default; -class Title: Default -{ - class Controls - { - class Title; - }; -}; -class RscCheckBox; -class Checkbox; +/* + +*/ class cfg3DEN { @@ -20,132 +13,79 @@ class cfg3DEN //onHistoryChange = "call gms3DEN_fnc_updateObjects"; }; }; - class Mission - { - class gms3DENmissionSettings - { - displayName = "Mission Settings"; - // display = "Display3DENEditAttributesPreview"; // Optional - display for attributes window. Must have the same structure and IDCs as the default Display3DENEditAttributes - class AttributeCategories - { - class gms3DENCategory - { - class Attributes - { - class missionStartMessage - { - property = "gmsMissionStartMessage"; - }; - class missionEndMessage - { - property = "gmsMissionEndMessage"; - }; - class missionDifficulty - { - property = "gmsMissionDifficulty"; - }; - }; - }; - }; - }; - }; class Attributes { + class Default; - class gms3DENCheckBoxGarrisonsControl: Title + class Title: Default { - onload = "call gms3DEN_fnc_onLoadGarrison;"; - onUnload = "diag_log 'onUnload for garrisons'"; - onCheckedChanged = "diag_log format['onCheckedChanged %1',_this];"; - attributeLoad = "(_this controlsGroupCtrl 100) ctrlSetText _value; [_this,_value] call gms3DEN_fnc_onAttributeLoadGarrison;"; - attributeSave = "[cbChecked (this controlsGroupCtrl 100)] call gms3DEN_fnc_onAttributeSaveGarrison;"; - - class Controls: Controls + class Controls { - class Title: Title {}; - class Value: CheckBox {}; - }; - - }; - class gmsGarrisonColorControl: Title - { - onload = "call gms3DEN_fnc_onLoadGarrisonColor;"; - //onUnload = "diag_log 'onUnload for garrisons'"; - attributeLoad = "[_this,_value] call gms3DEN_fnc_onAttributeLoadGarrisonColor;"; - attributeSave = "[_this,_value] call gms3DEN_fnc_onAttributeSaveGarrisonColor;"; - class Controls: Controls - { - class Title: Title {}; - class Value: CheckBox - { - idc = 101; - }; - }; - }; - class gms3DENCheckboxLootVehControl: Title - { - onload = "call gms3DEN_fnc_onLoadLootVeh;"; - //onUnload = "diag_log 'onUnload for loot veh'"; - onAttributeLoad = "[_this,_value] call gms3DEN_fnc_onAttributeLoadLootVeh;"; - onAttributeSave = "[_this,_value] call gms3DEN_fnc_onAttributeSaveLootVeh;"; - class Controls: Controls - { - class Title: Title {}; - class Value: CheckBox - { - idc = 102; - }; + class Title; }; }; - class gms3DENCLootVehicleColorControl: Title + class CheckBox; + class gms3DENCheckboxLootVehControl: CheckBox { - onload = "call gms3DEN_fnc_onLoadLootVehColor;"; + /* + Use on: Display, Control + Fired on: Fires when UI container is created, but no action is taken. The onLoad event for display fires after the onLoad events for all controls it contains are fired. + Returns: Display or control, for controls it also returns the control's config (since + Arma 3 logo black.png + 1.56 + ). + + params ["_displayOrControl", ["_config", configNull]]; + */ + + onload = "\ + params ['_displayOrControl', ['_config', configNull]];\ + diag_log format['_displayControl = %1 | _config = %2',_displayControl,_config];\ + [] call gms3DEN_fnc_onLoadLootVeh;\ + "; //onUnload = "diag_log 'onUnload for loot veh'"; - onAttributeLoad = "[_this,_value] call gms3DEN_fnc_onAttributeLoadLootVehColor;"; - onAttributeSave = "[_this,_value] call gms3DEN_fnc_onAttributeSaveLootVeh;"; - class Controls: Controls - { - class Title: Title {}; - class Value: CheckBox - { - idc = 103; - }; - }; + AttributeLoad = "\ + _checked = switch (true) do {\ + case (_value isequaltype 0): {([false,true] select (_value max 0 min 1))};\ + case (_value isequaltype ''): {([false,true] select ((parsenumber _value) max 0 min 1))};\ + default {_value};\ + };\ + (_this controlsGroupCtrl 100) cbsetchecked _checked;\ + diag_log format['onAttributeLoad:lootVehControl: _checked = %1',_checked];\ + "; + AttributeSave = "\ + cbchecked (_this controlsGroupCtrl 100);\ + diag_log format['onattributesave:lootVehControl: _checked = %1',cbchecked (_this controlsGroupCtrl 100)];\ + "; + }; + class gms3DENCLootVehicleColorControl: CheckBox + { + onload = "\ + params ['_displayOrControl', ['_config', configNull]];\ + diag_log format['_displayControl = %1 | _config = %2',_displayControl,_config];\ + [] call gms3DEN_fnc_onLoadLootVehColor;\ + "; + //onUnload = "diag_log 'onUnload for loot veh'"; + AttributeLoad = "\ + _checked = switch (true) do {\ + case (_value isequaltype 0): {([false,true] select (_value max 0 min 1))};\ + case (_value isequaltype ''): {([false,true] select ((parsenumber _value) max 0 min 1))};\ + default {_value};\ + };\ + (_this controlsGroupCtrl 100) cbsetchecked _checked;\ + diag_log format['onAttributeLoad:lootVehControlColor: _checked = %1',_checked];\ + "; + AttributeSave = "\ + cbchecked (_this controlsGroupCtrl 100);\ + diag_log format['onattributesave:lootVehColorControl: _checked = %1',cbchecked (_this controlsGroupCtrl 100)];\ + [cbchecked (_this controlsGroupCtrl 100)] call gms3DEN_fnc_setLootVehColor;\ + "; }; }; - class Object { class AttributeCategories { - class gms3DENgarrisonedAttribute - { - displayName = "Garrisons"; - collapsed = 1; - class Attributes - { - class GarrisonedAttribute - { - displayName = "Garrison"; - tooltip = "Mark as part of a garrison"; - property = "gmsIsGarrison"; - control = "gms3DENCheckBoxGarrisonsControl"; - //condition = ""; - expression = "_this setVariable ['%s',_value];"; - defaultValue = "false"; - }; - class GarrisonedColorAttribute - { - displayName = "Color On"; - tooltip = "Check to color this garrisoned object" - property = "gmsGarrisonColor"; - control = "gmsGarrisonColorControl"; - //condition = ""; - expression = "_this setVariable ['%s',_value];"; - defaultValue = "false"; - }; - }; - }; class gms3DENlootVehicles { displayName = "Loot Vehicle"; @@ -158,7 +98,7 @@ class cfg3DEN tooltip = "Set box to checked for loot vehicles"; property = "gmsIsLootVehicle"; control = "gms3DENCheckboxLootVehControl"; - //condition = ""; + condition = "objectVehicle "; expression = "_this setVariable ['%s',_value];"; defaultValue = "false"; }; @@ -168,12 +108,12 @@ class cfg3DEN tooltip = "Check box to color this loot vehicle"; property = "gmsLootVehicleColor"; control = "gms3DENCLootVehicleColorControl"; - //condition = ""; + condition = "objectVehicle "; expression = "_this setVariable ['%s',_value];"; defaultValue = "false"; }; }; }; }; - }; + }; }; \ No newline at end of file diff --git a/@GMS_3EDEN/addons/3DEN_plugin/gmsCfg3DENDisplay.h b/@GMS_3EDEN/addons/3DEN_plugin/gmsCfg3DENDisplay.h index a85dda2..036dafb 100644 --- a/@GMS_3EDEN/addons/3DEN_plugin/gmsCfg3DENDisplay.h +++ b/@GMS_3EDEN/addons/3DEN_plugin/gmsCfg3DENDisplay.h @@ -1,4 +1,7 @@ - +/* + Setup classes that add toolbar menus and define them and the code that is executed by them. + Copyright 2023 by Ghostrider[GRG] +*/ class ctrlMenuStrip; class display3DEN @@ -61,14 +64,149 @@ class display3DEN "GMS_crateSpawn", "GMS_lootSpawn", "GMS_location_Respawns", - "GMS_MissionCompletionMode" + "GMS_MissionCompletionMode", + "GMS_missionSpawnChance", + "GMS_minAI", + "GMS_maxAI" //"GMS_editMissionSettings" }; text = "Configure Mission"; toolTip = "Adjust Mission Settings"; }; + + class GMS_maxAI + { + text = "Max AI per Infantry Group"; + tooltip = "set the maximum AI per Infantry Group"; + items[] = { + "GMS_maxThree", + "GMS_maxFour", + "GMS_maxFive", + "GMS_maxSix", + "GMS_maxEight", + "GMS_maxNine" + }; + }; + class GMS_maxThree + { + text = "set max AI = 3"; + action = "[3] call gms3DEN_fnc_setMaxAI"; + }; + class GMS_maxFour + { + text = "set max AI = 4"; + action = "[4] call gms3DEN_fnc_setMaxAI"; + }; + class GMS_maxFive + { + text = "set max AI = 5"; + action = "[5] call gms3DEN_fnc_setMaxAI"; + }; + class GMS_maxSix + { + text = "set max AI = 6"; + action = "[6] call gms3DEN_fnc_setMaxAI"; + }; + class GMS_maxSeven + { + text = "set max AI = 7"; + action = "[7] call gms3DEN_fnc_setMaxAI"; + }; + class GMS_maxEight + { + text = "set max AI = 8"; + action = "[8] call gms3DEN_fnc_setMaxAI"; + }; + class GMS_maxNine + { + text = "set max AI = 9"; + action = "[9] call gms3DEN_fnc_setMaxAI"; + }; - class GMS_difficulty { + class GMS_minAI + { + text = "Min AI per Infantry Group"; + tooltip = "Set the minimum AI per infantry group"; + items[] = { + "GMS_minOne", + "GMS_minTwo", + "GMS_minThree", + "GMS_minFour", + "GMS_minFive", + "GMS_minSix" + }; + }; + class GMS_minOne + { + text = "set min AI = 1"; + action = "[1] call gms3DEN_fnc_setMinAI"; + }; + class GMS_minTwo + { + text = "set min AI = 2"; + action = "[2] call gms3DEN_fnc_setMinAI"; + }; + class GMS_minThree + { + text = "set min AI = 3"; + action = "[3] call gms3DEN_fnc_setMinAI"; + }; + class GMS_minFour + { + text = "set min AI = 4"; + action = "[4] call gms3DEN_fnc_setMinAI"; + }; + class GMS_minFive + { + text = "set min AI = 5"; + action = "[5] call gms3DEN_fnc_setMinAI"; + }; + class GMS_minSix + { + text = "set min AI = 6"; + action = "[6] call gms3DEN_fnc_setMinAI"; + }; + + + class GMS_missionSpawnChance + { + text = "Spawn Chance"; + toolTip = "Set the chance the mission will spawn"; + items[] = { + "GMS_spawnTwenty", + "GMS_spawnFourty", + "GMS_spawnSixty", + "GMS_spawnEighty", + "GMS_spawnHundred" + }; + }; + class GMS_spawnTwenty + { + text = "Spawn chance 20%"; + action = "[0.20] call gms3DEN_fnc_setSpawnChance;"; + }; + class GMS_spawnFourty + { + text = "Spawn chance 40%"; + action = "[0.40] call gms3DEN_fnc_setSpawnChance;"; + }; + class GMS_spawnSixty + { + text = "Spawn chance 60%"; + action = "[0.60] call gms3DEN_fnc_setSpawnChance;"; + }; + class GMS_spawnEighty + { + text = "Spawn chance 80%"; + action = "[0.80] call gms3DEN_fnc_setSpawnChance;"; + }; + class GMS_spawnHundred + { + text = "Spawn chance 100%"; + action = "[1.00] call gms3DEN_fnc_setSpawnChance;"; + }; + + class GMS_difficulty { text = "Difficulty"; toolTip = "Set Mission Difficulty"; items[] = { diff --git a/@GMS_3EDEN/addons/3DEN_plugin/gmsCfg3DENVersion.h b/@GMS_3EDEN/addons/3DEN_plugin/gmsCfg3DENVersion.h index 155273c..d6180bf 100644 --- a/@GMS_3EDEN/addons/3DEN_plugin/gmsCfg3DENVersion.h +++ b/@GMS_3EDEN/addons/3DEN_plugin/gmsCfg3DENVersion.h @@ -2,7 +2,7 @@ class CfgGMS3DENVersion { - version = 1.02; - build = 15; - date = "09/22/23"; + version = 1.1; + build = 16; + date = "09/23/23"; }; \ No newline at end of file diff --git a/@GMS_3EDEN/addons/3DEN_plugin/gmsCfgFunctions.h b/@GMS_3EDEN/addons/3DEN_plugin/gmsCfgFunctions.h index aa9b022..fa5ba5a 100644 --- a/@GMS_3EDEN/addons/3DEN_plugin/gmsCfgFunctions.h +++ b/@GMS_3EDEN/addons/3DEN_plugin/gmsCfgFunctions.h @@ -20,7 +20,8 @@ class CfgFunctions class display {}; class displayGarrisonMarkers {}; class displayLootMarkers {}; - class exportDynamic {}; + class exportDynamic {}; + class garrisonApplyChanges {}; class initialize {}; class initializeAttributes {}; class isInfantryUnit {}; @@ -33,7 +34,6 @@ class CfgFunctions class onAttributeSaveGarrison {}; class onAttributeSaveGarrisonColor {}; class onAttributeSaveLootVeh {}; - class onAttributeSaveLootVehColor {}; class onDrag {}; class onLoadGarrison {}; class onLoadGarrisonColor {}; @@ -46,7 +46,10 @@ class CfgFunctions class setCompletionMode {} class setGarrison {}; class setLoadCratesTiming {}; - class setLootVehicle {}; + class setLootVehColor {}; + class setMaxAI {}; + class setMinAI {}; + class setSpawnChance {}; class setSpawnLocations {}; class spawnCratesTiming {}; class versionInfo {}; diff --git a/@GMS_3EDEN/addons/3DEN_plugin/helperscripts.sqf b/@GMS_3EDEN/addons/3DEN_plugin/helperscripts.sqf new file mode 100644 index 0000000..9e31182 --- /dev/null +++ b/@GMS_3EDEN/addons/3DEN_plugin/helperscripts.sqf @@ -0,0 +1,21 @@ + + +{ + _m = format["object = %1",_x]; + systemChat _m; + diag_log _m; +} forEach nearestTerrainObjects [player, [], 50]; + +_u = player; +diag_log format["fn_isInside: _u = %1",_u]; +all3DENEntities params ["_objects"]; + +private _pos = getPosASL _u; +private _above = AGLToASL [_pos select 0, _pos select 1, (_pos select 2) + 100]; +private _below = AGLtoASL [_pos select 0, _pos select 1, (_pos select 2) - 10]; +private _objAbove = lineIntersects [_pos, _above, _u,_u]; +private _objBelow = lineIntersects [_pos, _below, _u,_u]; +private _isInside = if (_objAbove || _objBelow) then {true} else {false}; +_m = format["fn_isInside: _u = %4 | _objAbove = %1 | _objBelow = %2 | _isInside %3",_objAbove,_objBelow,_isInside,_u]; +systemchat _m; +diag_log _m; \ No newline at end of file diff --git a/@GMS_3EDEN/addons/3DEN_plugin/testingscripts.sqf b/@GMS_3EDEN/addons/3DEN_plugin/testingscripts.sqf new file mode 100644 index 0000000..ab18051 --- /dev/null +++ b/@GMS_3EDEN/addons/3DEN_plugin/testingscripts.sqf @@ -0,0 +1,20 @@ + + +_t1 = diag_tickTime; +_v1 = 0; +for "_i" from 1 to 100000 do +{ + if (_v1 == 0) then {true}; +}: +_m = format["elapsed time integer = %1",diag_tickTime - _t1]; +systemChat _m; +diag_log _m; +_t1 = diag_tickTime; +_v1 = "thisspecialvar"; +for "_i" from 1 to 100000 do +{ + if (_v1 isEqualTo "thisspecialvar") then {}; +}; +_m = format["elapsed time string = %1",diag_tickTime - _t1]; +systemChat _m; +diag_log _m; \ No newline at end of file