From ccb01edcc23f82dbf486b63fd52fceb3bfbe7bee Mon Sep 17 00:00:00 2001 From: Wyqer Date: Thu, 5 Sep 2019 19:28:28 +0200 Subject: [PATCH 1/4] Changed indentation --- .../scripts/server/ai/building_defence_ai.sqf | 52 +++++++++---------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/Missionframework/scripts/server/ai/building_defence_ai.sqf b/Missionframework/scripts/server/ai/building_defence_ai.sqf index 935ad0b1..fa84a80c 100644 --- a/Missionframework/scripts/server/ai/building_defence_ai.sqf +++ b/Missionframework/scripts/server/ai/building_defence_ai.sqf @@ -6,34 +6,34 @@ private _move_is_disabled = true; private _resume_movement = false; while {_move_is_disabled && local _unit && alive _unit && !(captive _unit)} do { - private _hostilecount = {alive _x && side _x == GRLIB_side_friendly} count ((getpos _unit) nearEntities [["Man"], 40]); + private _hostilecount = {alive _x && side _x == GRLIB_side_friendly} count ((getpos _unit) nearEntities [["Man"], 40]); - if ((_hostilecount > 0) || (damage _unit > 0.25)) then { - _resume_movement = true; - }; + if ((_hostilecount > 0) || (damage _unit > 0.25)) then { + _resume_movement = true; + }; - if (_sector != "") then { - if (_sector in blufor_sectors) then { - _resume_movement = true; - }; - }; + if (_sector != "") then { + if (_sector in blufor_sectors) then { + _resume_movement = true; + }; + }; - if (_resume_movement) then { - if (_move_is_disabled) then { - _move_is_disabled = false; - _unit enableAI "MOVE"; - _unit setUnitPos "AUTO"; - }; - }; + if (_resume_movement) then { + if (_move_is_disabled) then { + _move_is_disabled = false; + _unit enableAI "MOVE"; + _unit setUnitPos "AUTO"; + }; + }; - if (_move_is_disabled) then { - private _target = assignedTarget _unit; - if(!(isnull _target)) then { - private _vd = (getPosASL _target) vectorDiff (getpos _unit); - private _newdir = (_vd select 0) atan2 (_vd select 1); - if (_newdir < 0) then {_dir = 360 + _newdir}; - _unit setdir (_newdir); - }; - }; - sleep 5; + if (_move_is_disabled) then { + private _target = assignedTarget _unit; + if(!(isnull _target)) then { + private _vd = (getPosASL _target) vectorDiff (getpos _unit); + private _newdir = (_vd select 0) atan2 (_vd select 1); + if (_newdir < 0) then {_dir = 360 + _newdir}; + _unit setdir (_newdir); + }; + }; + sleep 5; }; From 88676234d1ecbf681255de2e5f74e5772052d0d5 Mon Sep 17 00:00:00 2001 From: Wyqer Date: Thu, 5 Sep 2019 20:09:50 +0200 Subject: [PATCH 2/4] Dynamic range for building defence ai --- .../scripts/server/ai/building_defence_ai.sqf | 33 ++++++++++--------- README.md | 1 + 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/Missionframework/scripts/server/ai/building_defence_ai.sqf b/Missionframework/scripts/server/ai/building_defence_ai.sqf index fa84a80c..f287c5bf 100644 --- a/Missionframework/scripts/server/ai/building_defence_ai.sqf +++ b/Missionframework/scripts/server/ai/building_defence_ai.sqf @@ -3,27 +3,30 @@ params ["_unit", ["_sector", ""]]; _unit setUnitPos "UP"; _unit disableAI "MOVE"; private _move_is_disabled = true; -private _resume_movement = false; +private _hostiles = 0; +private _ratio = 0.4; +private _range = 40; while {_move_is_disabled && local _unit && alive _unit && !(captive _unit)} do { - private _hostilecount = {alive _x && side _x == GRLIB_side_friendly} count ((getpos _unit) nearEntities [["Man"], 40]); - if ((_hostilecount > 0) || (damage _unit > 0.25)) then { - _resume_movement = true; + if !(_sector isEqualTo "") then { + _ratio = [_sector] call F_getForceRatio; }; - if (_sector != "") then { - if (_sector in blufor_sectors) then { - _resume_movement = true; - }; - }; + _range = floor (linearConversion [0, 1, _ratio, 0, GRLIB_capture_size / 3 * 2, true]); - if (_resume_movement) then { - if (_move_is_disabled) then { - _move_is_disabled = false; - _unit enableAI "MOVE"; - _unit setUnitPos "AUTO"; - }; + _hostiles = ((getPos _unit) nearEntities [["Man"], _range]) select {side _x == GRLIB_side_friendly}; + + if (_move_is_disabled && + { + (_sector in blufor_sectors) || + {!(_hostiles isEqualTo [])} || + {damage _unit > 0.25} + } + ) then { + _move_is_disabled = false; + _unit enableAI "MOVE"; + _unit setUnitPos "AUTO"; }; if (_move_is_disabled) then { diff --git a/README.md b/README.md index a351ba94..1a0f8d74 100644 --- a/README.md +++ b/README.md @@ -196,6 +196,7 @@ class Missions * Tweaked: Initial FOB box doesn't have equipment in the inventory anmore. * Tweaked: Height check for mobile respawn now relies on `isTouchingGround` instead of z value of position. * Tweaked: Transport config heights on M977 vehicles. Thanks to [FishAI](https://github.com/FishAI) +* Tweaked: AI in building now has a dynamic radius to look for enemies until they start moving again depending on blufor/opfor ratio in sector. * Fixed: Potato 01 was created after server restart, even if there was one saved. * Fixed: Missing variable `stats_blufor_teamkills_by_players`. Also no separation between by players or not by players for teamkills anymore. * Fixed: Factory storages could disappear randomly on save load. From 94790647c25f68356721cf249db7856b7a720377 Mon Sep 17 00:00:00 2001 From: Wyqer Date: Thu, 5 Sep 2019 21:06:09 +0200 Subject: [PATCH 3/4] Fixed lights are still on while lamp is hidden --- .../scripts/shared/functions/F_kp_createClearance.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Missionframework/scripts/shared/functions/F_kp_createClearance.sqf b/Missionframework/scripts/shared/functions/F_kp_createClearance.sqf index 3032a04c..7dcead19 100644 --- a/Missionframework/scripts/shared/functions/F_kp_createClearance.sqf +++ b/Missionframework/scripts/shared/functions/F_kp_createClearance.sqf @@ -9,8 +9,8 @@ params [ if (save_is_loaded && {(KP_liberation_clearances findIf {(_x select 0) isEqualTo _centerPos}) != -1}) exitWith {false}; { + _x switchLight "OFF"; _x hideObjectGlobal true; - _x enableSimulationGlobal false; _x allowDamage false; } forEach (nearestTerrainObjects [_centerPos, [], _radius, false, true]); From e239a50244a5aeb0f895fcee670a65986d2f827d Mon Sep 17 00:00:00 2001 From: Wyqer Date: Thu, 5 Sep 2019 21:11:25 +0200 Subject: [PATCH 4/4] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 1a0f8d74..c2eede9c 100644 --- a/README.md +++ b/README.md @@ -204,6 +204,7 @@ class Missions * Fixed: CUP Presets still had the Nemmera in the support vehicle section. Thanks to [Eogos](https://github.com/Eogos) * Fixed: FOB resources weren't updated in build dialog, when building infantry units. * Fixed: Some missing parameter information in the map screens parameter overview. +* Fixed: After creating a clearance at a FOB some light sources could remain. ### 0.96.5 (26th July 2019 due to Contacts Release) * Added: Contact DLC LDF preset.