From 8c98b3ba265025cc2393b32da11efa3c8ac42d00 Mon Sep 17 00:00:00 2001 From: Ken Mikkelsen Date: Mon, 17 Feb 2025 20:23:47 +0100 Subject: [PATCH] Add group settings Adds universal group settings for Attack, Flight and Dynamic reinforcement Disabling 'enableattack' on groups has the benefit of giving us more control of group actions (less running away doing random shit). The cost is that the AI will conduct fewer innate flanking attacks. --- addons/danger/XEH_preInitClient.sqf | 4 +- addons/danger/settings.inc.sqf | 64 +++++++++++++++++++++++++++++ addons/danger/stringtable.xml | 18 ++++++++ 3 files changed, 84 insertions(+), 2 deletions(-) diff --git a/addons/danger/XEH_preInitClient.sqf b/addons/danger/XEH_preInitClient.sqf index ce961a47..c288409a 100644 --- a/addons/danger/XEH_preInitClient.sqf +++ b/addons/danger/XEH_preInitClient.sqf @@ -10,7 +10,7 @@ Here four buttons are added: These functions and buttons could conceivably be moved to their own module. They might also benefit from added interface and more nuanced functions handling. That said: within the current scope of the AI mod. They can make a comfortable -home here. Until revisited by more capable personnell. +home here. Until revisited by more capable personell. - nkenny */ @@ -103,7 +103,7 @@ private _fnc_assault_AI = { } else { _cursorPos = getPos cursorObject; }; - private _buildings = [_cursorPos, 50, true, false] call EFUNC(main,findBuildings); + private _buildings = [_cursorPos, 12, true, false] call EFUNC(main,findBuildings); (group player) setVariable [QEGVAR(main,groupMemory), _buildings]; { private _enemy = _x findNearestEnemy _cursorPos; diff --git a/addons/danger/settings.inc.sqf b/addons/danger/settings.inc.sqf index 4ce55410..9c01a1fd 100644 --- a/addons/danger/settings.inc.sqf +++ b/addons/danger/settings.inc.sqf @@ -108,6 +108,70 @@ _curCat = LSTRING(Settings_GeneralCat); 1 ] call CBA_fnc_addSetting; +addMissionEventHandler ["GroupCreated", { + params ["_group"]; + [ + { + if (count (units _this) > 0) then { + if (GVAR(autoAddDynamicReinforcement)) then {_this setVariable [QGVAR(enableGroupReinforce), true, true];}; + if !(GVAR(disableAttackOverride)) then {_this enableAttack false;}; + if (GVAR(disableFleeingOverride)) then {_this allowFleeing 0;}; + }; + }, + _group, + 3 + ] call CBA_fnc_waitAndExecute; +}]; + +// auto disable enableAttack on groups +[ + QGVAR(disableAttackOverride), + "CHECKBOX", + [LSTRING(Settings_AttackOverride), LSTRING(Settings_AttackOverride_ToolTip)], + [COMPONENT_NAME, _curCat], + false, + false, { + params ["_value"]; + if (_value) exitWith {}; + if (!_value && time > 0) then { + {_x enableAttack false;} forEach (allGroups select {local (leader _x)}); + }; + } +] call CBA_fnc_addSetting; + +// auto disable allowFleeing on groups +[ + QGVAR(disableFleeingOverride), + "CHECKBOX", + [LSTRING(Settings_FleeingOverride), LSTRING(Settings_FleeingOverride_ToolTip)], + [COMPONENT_NAME, _curCat], + false, + false, { + params ["_value"]; + if (_value) exitWith {}; + if (!_value && time > 0) then { + {_x allowFleeing 0;} forEach (allGroups select {local (leader _x)}); + }; + } +] call CBA_fnc_addSetting; + +// auto add dynamic reinforcement +[ + QGVAR(autoAddDynamicReinforcement), + "CHECKBOX", + [LSTRING(Settings_UniversalDynamicReinforcement), LSTRING(Settings_UniversalDynamicReinforcement_ToolTip)], + [COMPONENT_NAME, _curCat], + false, + false, { + params ["_value"]; + if (!_value) exitWith {}; + if (_value) then { + {_x setVariable [QGVAR(enableGroupReinforce), true, true];} forEach (allGroups select {local (leader _x)}); + }; + } +] call CBA_fnc_addSetting; + + /* TEMPORARILY DISABLED FOR VERSION 2.5 RELEASE WAITING BETTER OR OTHER SOLUTION diff --git a/addons/danger/stringtable.xml b/addons/danger/stringtable.xml index 08f619cd..fed3a39b 100644 --- a/addons/danger/stringtable.xml +++ b/addons/danger/stringtable.xml @@ -422,5 +422,23 @@ Lamber Danger FSM Lambs Danger FSM + + Disable LAMBS Attack Override + + + LAMBS Danger.fsm introduces new attack patterns that in many cases replace vanilla options. If, for some reason, you want to keep the vanilla Attack cycle check this box. + + + Enable universal Dynamic Reinforcement + + + Enable this feature to apply Dynamic Reinforcement logic to all groups. This means all groups will respond to the Shared Information feature.\nBehaviours include: creating new waypoints, abandoning garrisons packing and claiming static weapons and vehicles.\nNB: This setting can dramatically alter missions. Use with care. + + + Disable vanilla fleeing feature + + + Chgecking this option prevents groups from initiating the default 'fleeing' mode. This can be particularly useful for ZEUS missions where the mission designer wants additional control of the group.\nThis setting is functionally identical with setting '(group) allowFleeing 0' in group inits +