From 03e68a7f3c1346543181ea440f13ab626614b9ff Mon Sep 17 00:00:00 2001 From: He-Man Date: Wed, 21 Nov 2018 18:55:02 +0100 Subject: [PATCH 1/6] Skip cleanup if players near --- .../Compiles/Units/GMS_fnc_cleanupDeadAI.sqf | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/@GMS/addons/custom_server/Compiles/Units/GMS_fnc_cleanupDeadAI.sqf b/@GMS/addons/custom_server/Compiles/Units/GMS_fnc_cleanupDeadAI.sqf index c10490a..55f0bf8 100644 --- a/@GMS/addons/custom_server/Compiles/Units/GMS_fnc_cleanupDeadAI.sqf +++ b/@GMS/addons/custom_server/Compiles/Units/GMS_fnc_cleanupDeadAI.sqf @@ -21,11 +21,14 @@ _aiList = +blck_deadAI; if ( diag_tickTime > _x getVariable ["blck_cleanupAt",0] ) then // DBD_DeleteAITimer { _ai = _x; - { - deleteVehicle _x; - }forEach nearestObjects [getPos _ai,["WeaponHolderSimulated","GroundWeapoonHolder"],3]; - blck_deadAI = blck_deadAI - [_ai]; - deleteVehicle _ai; + _nearplayer = (_ai nearEntities 1500) select {isplayer _x}; + if (_nearplayer isequalto []) then { + { + deleteVehicle _x; + }forEach nearestObjects [getPos _ai,["WeaponHolderSimulated","GroundWeapoonHolder"],3]; + blck_deadAI = blck_deadAI - [_ai]; + deleteVehicle _ai; + }; }; } forEach _aiList; From 199d503f4bc85669788e85ecc07eee695345dc24 Mon Sep 17 00:00:00 2001 From: He-Man Date: Mon, 26 Nov 2018 21:57:00 +0100 Subject: [PATCH 2/6] Random dir for static wpns --- .../Missions/GMS_fnc_spawnGarrisonInsideBuilding_relPos.sqf | 1 + 1 file changed, 1 insertion(+) diff --git a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnGarrisonInsideBuilding_relPos.sqf b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnGarrisonInsideBuilding_relPos.sqf index 1f80d2c..f95fae8 100644 --- a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnGarrisonInsideBuilding_relPos.sqf +++ b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnGarrisonInsideBuilding_relPos.sqf @@ -37,6 +37,7 @@ for "_i" from 1 to _statics do _allBldPsn = _allBldPsn - [_pos]; _staticClassName = selectRandom _typesStatics; _obj = [_staticClassName, [0,0,0], true] call blck_fnc_spawnVehicle; + _obj setdir (random 359); _obj setVariable["GRG_vehType","emplaced"]; _staticsSpawned pushBack _obj; //diag_log format["_fnc_spawnGarrisonInsideBuilding_relPos: _obj = %1 | _staticsSpawned = %2",_obj,_staticsSpawned]; From bbe3287ccadce771ad569e0a9ad12c1353ef6d08 Mon Sep 17 00:00:00 2001 From: He-Man Date: Mon, 26 Nov 2018 21:59:52 +0100 Subject: [PATCH 3/6] Random dir for static wpns --- .../Compiles/Missions/GMS_fnc_spawnEmplacedWeaponArray.sqf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnEmplacedWeaponArray.sqf b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnEmplacedWeaponArray.sqf index 9aed887..5f8d3b2 100644 --- a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnEmplacedWeaponArray.sqf +++ b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnEmplacedWeaponArray.sqf @@ -116,7 +116,8 @@ if (blck_debugLevel > 1) then }; #endif - _wep setVariable["GRG_vehType","emplaced"]; + _wep setVariable["GRG_vehType","emplaced"]; + _wep setdir (random 359); _wep setPos _pos; [_wep,false] call blck_fnc_configureMissionVehicle; _emplacedWeps pushback _wep; From 86d55ef11946c397162cf4dff3e91be2adb379f4 Mon Sep 17 00:00:00 2001 From: He-Man Date: Tue, 27 Nov 2018 17:23:29 +0100 Subject: [PATCH 4/6] Prevent dead cleanup and script fix 1. Using "_units = blck_liveMissionAI select (_i - 1);" could cause undefined behaviour if removing entries from array inside this loop. So always deleteat 0, but pushback if delete is not wanted / needed 2. Check first, if the AI is dead. If so, skip cleanup, so players can loot the corpse --- .../Compiles/Units/GMS_fnc_cleanupAliveAI.sqf | 31 +++++++------------ 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/@GMS/addons/custom_server/Compiles/Units/GMS_fnc_cleanupAliveAI.sqf b/@GMS/addons/custom_server/Compiles/Units/GMS_fnc_cleanupAliveAI.sqf index 5e841cd..b68fac2 100644 --- a/@GMS/addons/custom_server/Compiles/Units/GMS_fnc_cleanupAliveAI.sqf +++ b/@GMS/addons/custom_server/Compiles/Units/GMS_fnc_cleanupAliveAI.sqf @@ -37,31 +37,24 @@ for "_i" from 1 to (count blck_liveMissionAI) do { if ((_i) <= count blck_liveMissionAI) then { - _units = blck_liveMissionAI select (_i - 1); - //diag_log format["_fnc_cleanupAliveAI:: (34) evaluating with delete time = %2 and diag_tickTime %1", diag_tickTime, _units select 1]; - if (diag_tickTime > (_units select 1) ) then - { - //diag_log format["_fnc_cleanupAliveAI:: cleaning up AI group %1",_units]; + _units = blck_liveMissionAI deleteat 0; + _units params ["_unitsarr","_timer"]; + if (diag_tickTime > _timer) then { { - - //diag_log format["_fnc_cleanupAliveAI:: deleting unit %1",_x]; - //diag_log format["_fnc_cleanupAliveAI:: vehicle _x = %1",vehicle _x]; - //diag_log format["_fnc_cleanupAliveAI:: objectParent _x = %1",objectParent _x]; - - if ((alive _x) && !(isNull objectParent _x)) then // mark the vehicle for deletion - { - //diag_log format["_fnc_cleanupAliveAI: deleteing objectParent %1 [%3] for unit %2",objectParent _x, _x, typeName (objectParent _x), typeOf (objectParent _x)]; - [objectParent _x] call blck_fnc_deleteAIvehicle; + if (alive _x) then { + if (!isNull objectParent _x) then { + [objectParent _x] call blck_fnc_deleteAIvehicle; + }; + [_x] call blck_fnc_deleteAI; }; - [_x] call blck_fnc_deleteAI; - }forEach (_units select 0); + } forEach _unitsarr; uiSleep 0.1; - blck_liveMissionAI set[(_i - 1), -1]; - blck_liveMissionAI = blck_liveMissionAI - [-1]; // Remove that list of live AI from the list. - #ifdef blck_debugMode if (blck_debugLevel > 1) then {diag_log format["_fnc_mainTread:: blck_liveMissionAI updated to %1",blck_liveMissionAI];}; #endif + } + else { + blck_liveMissionAI pushback _units; }; }; }; From 901339c334268ffa62f1a34cc7e15ff855f14d3d Mon Sep 17 00:00:00 2001 From: He-Man Date: Tue, 27 Nov 2018 18:43:47 +0100 Subject: [PATCH 5/6] Simulationhandler fixes 1. Players inside Vehicles were not detected 2. It was checked on groups, if simulationEnabled. But must be checked on the units --- .../Groups/GMS_fnc_missionGroupMonitor.sqf | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/@GMS/addons/custom_server/Compiles/Groups/GMS_fnc_missionGroupMonitor.sqf b/@GMS/addons/custom_server/Compiles/Groups/GMS_fnc_missionGroupMonitor.sqf index d5f7ecc..0b43efa 100644 --- a/@GMS/addons/custom_server/Compiles/Groups/GMS_fnc_missionGroupMonitor.sqf +++ b/@GMS/addons/custom_server/Compiles/Groups/GMS_fnc_missionGroupMonitor.sqf @@ -157,30 +157,32 @@ _fn_monitorGroupWaypoints = { _fn_simulationMonitor = { private["_playerType","_players"]; - + _playerType = ["LandVehicle","SHIP","AIR","TANK"]; if (blck_modType isEqualTo "Exile") then { - _playerType = ["Exile_Unit_Player"]; + _playerType = _playerType + ["Exile_Unit_Player"]; }else{ - _playerType = ["Epoch_Male_F","Epoch_Female_F"]; + _playerType = _playerType + ["Epoch_Male_F","Epoch_Female_F"]; }; { - _players = (leader _x) nearEntities [_playerType, blck_simulationEnabledDistance]; + _players = ((leader _x) nearEntities [_playerType, blck_simulationEnabledDistance]) select {isplayer _x}; if (count _players > 0) then { - if !(simulationEnabled _x) then - { - { + { + if !(simulationEnabled _x) then + { _x enableSimulationGlobal true; (_players select 0) reveal _x; // Force simulation on - }forEach (units _x); - }; + }; + }forEach (units _x); }else{ // Be sure simulation is off for all units in the group. - if (simulationEnabled _x) then { - {_x enableSimulationGlobal false}forEach (units _x); - }; + if (simulationEnabled _x) then + { + _x enableSimulationGlobal false; + }; + }forEach (units _x); }; } forEach blck_monitoredMissionAIGroups; }; From 4f823e70f24e3c7eb8aa4d521aa95bd714936f9c Mon Sep 17 00:00:00 2001 From: "Ghostrider [GRG]" Date: Tue, 27 Nov 2018 21:26:43 -0500 Subject: [PATCH 6/6] Fix issue with _blck_AllMissionAI Calculations of the number of AI killed that trigger mission completion were incorrect. This has been addressed. --- .../Compiles/Missions/GMS_fnc_missionSpawner.sqf | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner.sqf b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner.sqf index bdf2de6..2f27578 100644 --- a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner.sqf +++ b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner.sqf @@ -444,14 +444,8 @@ private _spawnPara = if (random(1) < _chancePara) then {true} else {false}; } forEach _crates; private["_minNoAliveForCompletion","_result","_minPercentageKilled"]; -if (_secureAsset) then -{ - _minNoAliveForCompletion = round((1 - blck_killPercentage) * (({alive _x} count _blck_AllMissionAI) - 1)); - if (_minNoAliveForCompletion < 2) then {_minNoAliveForCompletion = 2}; -} else { - _minNoAliveForCompletion = floor((1 - blck_killPercentage) * ({alive _x} count _blck_AllMissionAI)); - if (_minNoAliveForCompletion == 0) then {_minNoAliveForCompletion = 1}; -}; +_minNoAliveForCompletion = (count _blck_AllMissionAI) - (round(blck_killPercentage * (count _blck_AllMissionAI))); +if (_secureAsset) then {_minNoAliveForCompletion = _minNoAliveForCompletion + 1}; while {_missionComplete isEqualTo -1} do {