diff --git a/addons/danger/functions/fnc_brainVehicle.sqf b/addons/danger/functions/fnc_brainVehicle.sqf index d670ad0f..a71f9ec4 100644 --- a/addons/danger/functions/fnc_brainVehicle.sqf +++ b/addons/danger/functions/fnc_brainVehicle.sqf @@ -154,6 +154,13 @@ if (_armored && {!isNull _dangerCausedBy}) exitWith { && {!(terrainIntersectASL [eyePos _vehicle, (eyePos _dangerCausedBy) vectorAdd [0, 0, 2]]) || {_distance < 200}} ) exitWith { + // use smoke if available + private _time = _vehicle getVariable [QEGVAR(main,smokescreenTime), 0]; + if (RND(0.6) && {_time < time}) then { + (commander _vehicle) forceWeaponFire ["SmokeLauncher", "SmokeLauncher"]; + _vehicle setVariable [QEGVAR(main,smokescreenTime), time + 30 + random 20]; + }; + // define enemy direction _group setFormDir (_vehicle getDir _dangerCausedBy); _cargo doMove _dangerPos; @@ -203,7 +210,7 @@ if (_car) exitWith { private _slow = speed _vehicle < 30; // escape ~ if enemy within 15-50 meters or explosions are nearby! - if (_slow && {_cause isEqualTo DANGER_EXPLOSION || {_vehicle distanceSqr _dangerCausedBy < (225 + random 1225)}}) exitWith { + if (_slow && {(side _dangerCausedBy) isNotEqualTo (side _unit)} && {_cause isEqualTo DANGER_EXPLOSION || {_vehicle distanceSqr _dangerCausedBy < (225 + random 1225)}}) exitWith { [_unit] call EFUNC(main,doVehicleJink); [_timeout + 3] + _causeArray }; diff --git a/addons/danger/functions/fnc_tacticsAssault.sqf b/addons/danger/functions/fnc_tacticsAssault.sqf index 25d0a2da..2eee7108 100644 --- a/addons/danger/functions/fnc_tacticsAssault.sqf +++ b/addons/danger/functions/fnc_tacticsAssault.sqf @@ -18,7 +18,7 @@ * * Public: No */ -params ["_group", "_target", ["_units", []], ["_cycle", 16], ["_delay", 70]]; +params ["_group", "_target", ["_units", []], ["_cycle", 18], ["_delay", 70]]; // group is missing if (isNull _group) exitWith {false}; @@ -82,6 +82,18 @@ _group setVariable [QEGVAR(main,groupMemory), _housePos]; // add base position if (_housePos isEqualTo []) then {_housePos pushBack _target;}; +// find vehicles +private _vehicles = [_unit] call EFUNC(main,findReadyVehicles); +private _overwatch = [POSITIONAGL(_unit), EGVAR(main,minSuppressionRange) * 2, EGVAR(main,minSuppressionRange), 4, _target] call EFUNC(main,findOverwatch); +if (_overwatch isNotEqualTo []) then { + { + private _roads = _overwatch nearRoads 30; + if (_roads isNotEqualTo []) then {_overwatch = POSITIONAGL(selectRandom _roads);}; + _x doMove _overwatch; + _x doWatch (selectRandom _housePos); + } forEach _vehicles; +}; + // set tasks _unit setVariable [QEGVAR(main,currentTarget), _target, EGVAR(main,debug_functions)]; _unit setVariable [QEGVAR(main,currentTask), "Tactics Assault", EGVAR(main,debug_functions)]; diff --git a/addons/main/functions/GroupAction/fnc_doGroupFlank.sqf b/addons/main/functions/GroupAction/fnc_doGroupFlank.sqf index c4043912..70ae7281 100644 --- a/addons/main/functions/GroupAction/fnc_doGroupFlank.sqf +++ b/addons/main/functions/GroupAction/fnc_doGroupFlank.sqf @@ -18,14 +18,12 @@ * * Public: No */ -params ["_cycle", "_units", "_vehicles", "_pos", "_overwatch"]; +params ["_cycle", "_units", "_vehicles", "_pos", "_overwatch", ["_teamAlpha", 0]]; // update _units = _units select { _x call FUNC(isAlive) && { !isPlayer _x } && {_x distance2D _overwatch > 5}}; _vehicles = _vehicles select { canFire _x }; -private _posASL = AGLtoASL (selectRandom _pos); - { private _suppressed = (getSuppression _x) > 0.5; _x setUnitPos (["MIDDLE", "DOWN"] select _suppressed); @@ -36,23 +34,29 @@ private _posASL = AGLtoASL (selectRandom _pos); _x setVariable [QEGVAR(danger,forceMove), !_suppressed]; // suppress + private _posASL = AGLtoASL (selectRandom _pos); if ( - RND(0.6) - && {(leader _x) isNotEqualTo _x} + (_forEachIndex mod 2) isEqualTo _teamAlpha && {!(terrainIntersectASL [eyePos _x, _posASL vectorAdd [0, 0, 3]])} ) then { - [{_this call FUNC(doSuppress)}, [_x, _posASL vectorAdd [0, 0, random 1], true], random 3] call CBA_fnc_waitAndExecute; + [{_this call FUNC(doSuppress)}, [_x, _posASL vectorAdd [0, 0, random 1], true], 1 + random 3] call CBA_fnc_waitAndExecute; }; } foreach _units; +// reset alpha status +_teamAlpha = [0, 1] select (_teamAlpha isEqualTo 0); + // vehicles -if (_cycle isEqualTo 1) then { +if ((_cycle mod 2) isEqualTo 0) then { { private _posAGL = selectRandom _pos; _x doWatch _posAGL; [_x, _posAGL] call FUNC(doVehicleSuppress); } foreach _vehicles; } else { + // check for roads + private _roads = _overwatch nearRoads 50; + if (_roads isNotEqualTo []) exitWith {_vehicles doMove (POSITIONAGL(selectRandom _roads));}; _vehicles doMove _overwatch; }; @@ -60,7 +64,7 @@ if (_cycle isEqualTo 1) then { if !(_cycle <= 1 || {_units isEqualTo []}) then { [ {_this call FUNC(doGroupFlank)}, - [_cycle - 1, _units, _vehicles, _pos, _overwatch], + [_cycle - 1, _units, _vehicles, _pos, _overwatch, _teamAlpha], 10 + random 8 ] call CBA_fnc_waitAndExecute; }; diff --git a/addons/main/functions/VehicleAction/fnc_doVehicleJink.sqf b/addons/main/functions/VehicleAction/fnc_doVehicleJink.sqf index f87bde94..ce7546b7 100644 --- a/addons/main/functions/VehicleAction/fnc_doVehicleJink.sqf +++ b/addons/main/functions/VehicleAction/fnc_doVehicleJink.sqf @@ -58,8 +58,16 @@ _destination = _destination select {(_x isNotEqualTo []) && {!(surfaceIsWater _x if (_destination isEqualTo []) exitWith { getPosASL _unit }; _destination = selectRandom _destination; +// check for roads +private _roads = _destination nearRoads (_range * 0.5); +if (_roads isNotEqualTo []) then {_destination = POSITIONAGL(selectRandom _roads);}; + // make tanks pop smoke when moving -// _vehicle forceweaponfire ["SmokeLauncher", "SmokeLauncher"]; <-- not working! Will revist at a later date - nkenny +private _time = _vehicle getVariable [QGVAR(smokescreenTime), 0]; +if (RND(0.4) && {_time < time}) then { + (commander _vehicle) forceWeaponFire ["SmokeLauncher", "SmokeLauncher"]; + _vehicle setVariable [QGVAR(smokescreenTime), time + 30 + random 20]; +}; // execute _vehicle doMove _destination;