Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Assault group tactics #308

Merged
merged 4 commits into from
Feb 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions addons/danger/functions/fnc_tacticsAssault.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*
* Public: No
*/
params ["_unit", "_target", ["_units", []], ["_cycle", 15], ["_delay", 80]];
params ["_unit", "_target", ["_units", []], ["_cycle", 11], ["_delay", 90]];

// find target
_target = _target call CBA_fnc_getPos;
Expand Down Expand Up @@ -55,7 +55,10 @@ if (_units isEqualTo []) exitWith {false};

// sort potential targets
private _buildings = [_target, 8, true, false] call EFUNC(main,findBuildings);
_buildings append ((_unit targets [true, 10, [], 0, _target]) apply {_unit getHideFrom _x});
_buildings append ((_unit targets [true, 12, [], 0, _target]) apply {getPosATL _x});
_buildings = _buildings apply { [_x select 2, _x] };
_buildings sort false;
_buildings = _buildings apply { _x select 1 };
_buildings pushBack _target;

// set tasks
Expand All @@ -80,10 +83,10 @@ _group enableAttack false;
if (!GVAR(disableAutonomousSmokeGrenades) && {_unit distance2D _target > 25}) then {

// leader smoke
if ((getSuppression _unit) isNotEqualTo 0) then {[_unit, _target] call EFUNC(main,doSmoke);};
[_unit, _target] call EFUNC(main,doSmoke);

// grenadier smoke
[{_this call EFUNC(main,doUGL)}, [+_units, _target, "shotSmokeX"], 3] call CBA_fnc_waitAndExecute;
[{_this call EFUNC(main,doUGL)}, [_units, _target, "shotSmokeX"], 3] call CBA_fnc_waitAndExecute;
};

// ready group
Expand Down
26 changes: 15 additions & 11 deletions addons/main/functions/GroupAction/fnc_doGroupAssault.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -20,30 +20,34 @@ params ["_cycle", "_units", "_pos"];

// update
_units = _units select {_x call FUNC(isAlive) && {!isPlayer _x}};
if (_units isEqualTo []) exitWith {};
if (_units isEqualTo [] || {_pos isEqualTo []}) exitWith {false};

private _targetPos = _pos deleteAt 0;
{
private _targetPos = selectRandom _pos;
// setpos
if (RND(0.5) || {(currentCommand _x) isNotEqualTo "MOVE"}) then {
_x doMove _targetPos;
_x setDestination [_targetPos, "FORMATION PLANNED", false]; // added to reduce cover bounding - nkenny
_x lookAt _targetPos;
};

// manoeuvre
_x forceSpeed 4;
_x forceSpeed 3;
_x setUnitPosWeak (["UP", "MIDDLE"] select (getSuppression _x isNotEqualTo 0));
_x setVariable [QGVAR(currentTask), "Group Assault", GVAR(debug_functions)];
_x setVariable [QEGVAR(danger,forceMove), true];

// check enemy
private _enemy = _x findNearestEnemy _x;
nk3nny marked this conversation as resolved.
Show resolved Hide resolved
if (_x distance2D _enemy < 12) then {_targetPos = getPosATL _enemy;};

// setpos
if (RND(0.75) || {(currentCommand _x) isNotEqualTo "MOVE"}) then {
_x lookAt _targetPos;
_x doMove _targetPos;
_x setDestination [_targetPos, "LEADER PLANNED", false]; // added to reduce cover bounding - nkenny
};
} foreach _units;

// recursive cyclic
if !(_cycle <= 1 || {_units isEqualTo []}) then {
[
{_this call FUNC(doGroupAssault)},
[_cycle - 1, _units, _pos],
5
8
] call CBA_fnc_waitAndExecute;
};

Expand Down