Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
Sign in to follow this  
Kydoimos

Way to Make Group Flee?

Recommended Posts

Hi all, was just curious, is there a way to make a group of units flee or run away? allowFleeing only increases the chance of a unit running away and the movement waypoint type 'CARELESS' only allows groups to walk (individuals, however, will run). I've got waypoints for the group to move to, but they don't really try to disengage the enemy and run away...

Share this post


Link to post
Share on other sites

Thanks for the response! It doesn't I'm afraid - I put that on the Feedback Tracker and I was told that it only makes groups 'more likely' to flee.

---------- Post added at 09:43 ---------- Previous post was at 09:42 ----------

http://feedback.arma3.com/view.php?id=20838&nbn=4

There's the ticket :)

Share this post


Link to post
Share on other sites

Thanks Iceman77 - love your signature! :) Yes, I've given that a whirl - though I might need to check the AutoTarget, as that sounds like it could help. Still having trouble though - I think it might be a bug, as the "CARELESS" mode should really allow groups to run at full speed setting. Ah, well. Guess I'll probably have to try and make do!

Share this post


Link to post
Share on other sites

if you want them to "Retreat" then simply have a waypoint waiting on a retreat condition

Share this post


Link to post
Share on other sites

Not sure, if/what changed in A3, but problems with disengaging was known also in A2, so I made for A2 such function, maybe still anyhow useful under A3:

RYD_Disengage = 
{
private ["_gp","_tgt","_side","_cnt","_mode","_group","_tempGps","_units","_start","_tgtPos","_units","_alive","_enabledA","_beh","_cm","_units0","_isStuck"];

_gp = _this select 0;
_start = getPosATL (vehicle (leader _gp));
_tgt = _this select 1;
_side = side _gp;
_mode = 0;
if ((count _this) > 2) then {_mode = _this select 2};

[_gp, (currentWaypoint _gp)] setWaypointPosition [position (vehicle (leader _gp)), 0];

while {((count (waypoints _gp)) > 0)} do
	{
	 deleteWaypoint ((waypoints _gp) select (count (waypoints _gp) - 1))
	};

_enabledA = attackEnabled _gp;
_gp enableAttack false;

_beh = "CARELESS";
_cm = "BLUE";

if (_mode >= 1) then
	{
	_beh = "AWARE";
	_cm = "GREEN"
	};

_tempGps = [];
_units = units _gp;

	{
	_x setUnitPos "UP";
	_x disableAI "TARGET";
	_x disableAI "AUTOTARGET";

	if (_mode >= 2) then
		{
		_group = createGroup _side;
		_tempGps set [(count _tempGps),_group];
		[_x] joinSilent _group;
		};

	_tgtPos = [(_tgt select 0) + (random 20) - 10,(_tgt select 1) + (random 20) - 10,0];
	_x doMove _tgtPos;
	_x setVariable ["tgtPos",_tgtPos];
	_x setVariable ["isStuck",0];

	if (_mode >= 2) then
		{
		_group setBehaviour _beh;
		_group setSpeedMode "FULL";
		_group setCombatMode _cm
		}
	}
foreach (units _gp);

if (_mode < 2) then
	{
	_gp setBehaviour _beh;
	_gp setSpeedMode "FULL";
	_gp setCombatMode _cm
	}
else
	{
	deleteGroup _gp
	};

waitUntil
	{
	sleep 5;

	_units0 = +_units;

		{
		if (isNull _x) then 
			{
			_units = _units - [_x]
			}
		else
			{
			if not (alive _x) then
				{
				_units = _units - [_x]
				}
			else
				{
				if ((abs (speed _x)) < 0.01) then 
					{
					_isStuck = _x getVariable "isStuck";
					if (_isStuck > 12) exitWith
						{
						_units = _units - [_x];
						_x setVariable ["tgtPos",nil];
						_x setVariable ["isStuck",nil];
						};

					_x setVariable ["isStuck",_isStuck + 1];
					_tgtPos = _x getVariable "tgtPos";
					_x doMove _tgtPos;
					}
				else
					{
					_x setVariable ["isStuck",0]
					}
				}
			}
		}
	foreach _units0;

	_cnt = {(((_x distance _tgt) > 30) and ((_x distance _start) < (_start distance _tgt)))} count _units;

	(_cnt == 0)
	};

if (_mode >= 2) then
	{
	_gp = createGroup _side;

		{
		[(leader _x)] joinSilent _gp;
		deleteGroup _x
		}
	foreach _tempGps
	};

	{
	_x setVariable ["tgtPos",nil];
	_x setVariable ["isStuck",nil];
	_x setUnitPos "AUTO";
	_x enableAI "TARGET";
	_x enableAI "AUTOTARGET";
	}
foreach (units _gp);

_gp setBehaviour "AWARE";
_gp setSpeedMode "NORMAL";
_gp setCombatMode "YELLOW";
_gp setFormation "WEDGE";

if (_enabledA) then {_gp enableAttack true}
};

exemplary use:

{
[_x,getPosATL runPos,0] spawn RYD_Disengage
}
foreach [Group1,Group2];

Relevant thread here.

Share this post


Link to post
Share on other sites

Cheers chaps! I found the WP system a little buggy - but managed to resolve the issue with the doMove command, as it lets units run in "careless" mode. Thanks again for all your responses! Hopefully it might help others with a similar issue! :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

×