Skip to content

Commit

Permalink
Update fnc_tacticsFlank.sqf
Browse files Browse the repository at this point in the history
Improves cover selection accuracy.  Enhances many instances where the AI would pick wide open places to find cover.

Relies on #341
  • Loading branch information
nk3nny committed Mar 4, 2024
1 parent 618424f commit 4318552
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions addons/danger/functions/fnc_tacticsFlank.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*
* Public: No
*/
params ["_group", "_target", ["_units", []], ["_cycle", 4], ["_overwatch", []], ["_delay", 120]];
params ["_group", "_target", ["_units", []], ["_cycle", 5], ["_overwatch", []], ["_delay", 120]];

// group is missing
if (isNull _group) exitWith {false};
Expand All @@ -31,6 +31,9 @@ private _unit = leader _group;

// find target
_target = _target call CBA_fnc_getPos;
if ((_target select 2) > 6) then {
_target set [2, 0.5];
};

// check CQB ~ exit if in close combat other functions will do the work - nkenny
if (_unit distance2D _target < GVAR(cqbRange)) exitWith {
Expand Down Expand Up @@ -74,11 +77,11 @@ _pos pushBack _target;
// find overwatch position
if (_overwatch isEqualTo []) then {
private _distance2D = ((_unit distance2D _target) * 0.66) min 250;
_overwatch = selectBestPlaces [_target, _distance2D, "(2 * hills) + (2 * forest + trees + houses) - (2 * meadow) - (2 * windy) - (2 * sea) - (10 * deadBody)", 100 , 3] apply {[(_x select 0) distance2D _unit, _x select 0]};
_overwatch = selectBestPlaces [_target, _distance2D, "(2 * hills) + (2 * (forest + trees + houses)) - (2 * meadow) - (2 * windy) - (2 * sea) - (10 * deadBody)", 20 , 4] apply {[(_x select 0) distance2D _unit, _x select 0]};
_overwatch = _overwatch select {!(surfaceIsWater (_x select 1))};
_overwatch sort true;
_overwatch = _overwatch apply {_x select 1};
if (_overwatch isEqualTo []) then {_overwatch pushBack ([getPos _unit, _distance2D, 100, 8, _target] call EFUNC(main,findOverwatch));};
if (_overwatch isEqualTo []) then {_overwatch pushBack ([POSITIONAGL(_unit), _distance2D, 100, 8, _target] call EFUNC(main,findOverwatch));};
_overwatch = _overwatch select 0;
};

Expand Down

0 comments on commit 4318552

Please sign in to comment.