Jump to content

Recommended Posts

Regarding the AI Fleeing section of https://community.bistudio.com/wiki/Arma_3_AI_Behavior

 

It reads:

Quote

Courage of an AI group is based on the group's leader Courage skill. Each group has an initial strength (sum of undamaged armor and health of all units). If the group losses are higher than the initial strength multiplied by leader's Courage then the group will start fleeing. Primarily it goes to a supply point, secondarily it will try to find a safe position within a 600m radius from the initial waypoint (danger, distance, amount of cover positions are taken into account). After the fleeing has been finished the group's initial strength is reset.

 

Specifically:

Quote

If the group losses are higher than the initial strength multiplied by leader's Courage then the group will start fleeing. Primarily it goes to a supply point

 

Does anyone know what a "supply point" is in the given context? I have experimented with the AI fleeing behaviour with ammo boxes and the "Resupply point" location entity to no effect.

 

Share this post


Link to post
Share on other sites

Did you find the solution for this? I never see them fleeing. Even with courage set to 0 they fight to the last man. This AI is way too kamikaze. 

Share this post


Link to post
Share on other sites

AI sometimes flees. When I'm doing a 'secure' mission and I can't find the last guy, he is always near a vehicle (supply point). Can even be a destroyed vehicle. Final units are fleeing to these vehicles.

 

That said, they don't flee quickly. I use a script with a trigger. If the amount of enemy within the trigger is lower than x, the flee script is activated sending everybody in the trigger moving to a target point that I defined.

 

 

Share this post


Link to post
Share on other sites

The fleeing behaviour is more visible when AI got waypoints. When they flee they go back to the initial WP.

Share this post


Link to post
Share on other sites
16 minutes ago, joostsidy said:

AI sometimes flees. When I'm doing a 'secure' mission and I can't find the last guy, he is always near a vehicle (supply point). Can even be a destroyed vehicle. Final units are fleeing to these vehicles.

 

That said, they don't flee quickly. I use a script with a trigger. If the amount of enemy within the trigger is lower than x, the flee script is activated sending everybody in the trigger moving to a target point that I defined.

 

 

 

How is this behaviour activated through scripting? The only variable I know is "allowfleeing", but that didn't work so far, at least not fast enough, or do you set up move waypoints in the trigger?

 

14 minutes ago, ProfTournesol said:

The fleeing behaviour is more visible when AI got waypoints. When they flee they go back to the initial WP.

 

In the mission I'm trying the squad is already in a base that's being attacked, so there is no usable initial WP but I'll try for future cases. 

Share this post


Link to post
Share on other sites

Hm... That command should work. Are you doing it on the whole group?

// In group leader init
{
	_x allowFleeing 0;
} forEach units group this;

 

Share this post


Link to post
Share on other sites

Yes, that's what I used. Are there any other necessary conditions besides a resupply point or covering positions nearby?

Share this post


Link to post
Share on other sites

Hm... Not sure.

 

EDIT: You could try to mess with the skill of the units.

https://community.bistudio.com/wiki/setSkill_array

This one: courage

Though, I think the allowFleeing command is suppose to change that, maybe it's not working? If you want to upload your mission somewhere, I can check it out for you if you would like.

Share this post


Link to post
Share on other sites

Probably is, yup.

Share this post


Link to post
Share on other sites
16 hours ago, b3lx said:

 

How is this behaviour activated through scripting? The only variable I know is "allowfleeing", but that didn't work so far, at least not fast enough, or do you set up move waypoints in the trigger?

 

 

Basically I make all units join grpNull (ungroup) and setBehaviour 'CARELESS'. Then I use doMove to move them to a target (a long distance away). It works very nice. You might be involved in CQB in a large building, when the amount of enemies drop below  threshold and they will try to exit the building and move to the flee point. In CARELESS mode they will still try to shoot you when they see you! It's kind of a unstructured retreat. This makes for increased action in the final part of an objective.

 

Units that fail to move because they are stuck somewhere will be killed automatically.

Share this post


Link to post
Share on other sites

Thanks for the tips guys. I'm still learning as I go along,  I'll post my script soon.

Share this post


Link to post
Share on other sites

So here it is. It works! But there are still some caveats:

1 - When they start retreating they will still shoot the enemy if visible (which is fine) but they behave too cool about it. Only a few seconds later they will really run and this interval is enough to be wiped clean. 

2 - I'm going to make them regroup and return to "aware" when they are near the retreat point.

/* place on a unit's init to force fleeing:
[this, "contact"] execVM "forceflee.sqf"
passed parameters are unit and mode. Mode is the event that triggers fleeing: "contact", "morale" or "variable" .Variable 

is activated by setting  _fleetrg to true.*/

private ["_ld","_mode","_enemy","_gp","_repeat","_dir","_floc","_fleetrg"];

_ld = _this select 0; 
_mode = _this select 1; 
_gp = (group _ld);
_repeat = true; // makes the "while do" condition start
_fleetrg = false; // variable usable in a trigger


// function to find location 300 meters opposite to known enemy, split group into individuals and move them to location
_flee = {
	_dir = 180 + (_ld getDir _enemy); //direction opposite to enemy
	_floc = _ld getrelPos [300,_dir]; //finds location at 300 in established direction.
	_unitarray = units _gp;
	_unitarray join grpNull;
	{
		_x setBehaviour "CARELESS";
		_x setSpeedMode "FULL";
		_x doMove _floc;
	} forEach _unitarray;
	_repeat = false;
};

//executes function when condition for each mode is met
while {_repeat} do {
	sleep 2;
	_ld = leader _gp; // redefines _ld in case the initial leader is dead	
	_enemy = (_ld findNearestEnemy _ld);
	if ((_mode == "morale") && (morale (leader _gp) < 0.3)) then {call _flee};
	if ((_mode == "contact") && (_ld knowsAbout _enemy > 0)) then {call _flee};
	if ((_mode == "variable") && (_fleetrg)) then {call _flee};
};

 

  • Like 3

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×