Jump to content
scottb613

Disengage Properly - with Haste.

Recommended Posts

Hi Folks,

 

Now that I have my flare issue sorted - I'm trying to properly disengage from combat. The mission premise is that I hit an enemy camp hard and fast to rescue some POW's - then pull out before the enemy has time to react. I've been around long enough to know that disengaging from combat is an issue with Arma - in the past FHQ Combat seemed to work with the player squad - I'm not using it now. I've searched around looking for help - haven't found too much - speedy AI exits are not Arma's forte.

 

Here is what I am trying to do on three AI squads. It kind of works but the results aren't consistent. Most times only a single unit ignores all this and freezes in place. Most times it's the same unit - most times the squad leader. Once in a while it works. I've done hours of testing. I had to add sleeps - as when run without delay - half the squad would ignore this.

 

{ 
	_x setUnitPos "UP";
	_x forceSpeed 100;
	_x disableAI "CHECKVISIBLE";
	_x disableAI "COVER";
	_x disableAI "AUTOTARGET";
	_x disableAI "TARGET";
	_x disableAI "SUPPRESSION";
	_x disableAI "AUTOCOMBAT";
	_x setBehaviour "CARELESS";
	_x setCombatMode "GREEN";
	_x doMove (getMarkerPos "Rall_1");
	sleep .5;
} forEach units Seal_1;

 

I built a quick test mission all vanilla - if anyone cares to test.

  • Trigger Radio Alpha starts the attack.
  • Trigger Radio Bravo orders the withdrawal. 
  • The OPFOR is looking in the opposite direction - so the player needs to initiate gunfire to put everyone in Combat Mode.

 

Test Mission: "[SCO]SOG_Withdraw.Altis" - all Vanilla - no PBO.

https://mega.nz/file/Rp400KZQ#xAsHL7XelIa4ZfCPTBZLElWCv0m-2FooJHgnDZ04BT8

 

Regards,
Scott 

 

Share this post


Link to post
Share on other sites
28 minutes ago, scottb613 said:

_x forceSpeed 100;

 

You are telling your infantry units to run at 100 meters per second/360KMH.

 

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

 

Quote

In the case of infantry units, it is recommended to use getSpeed for better and more accurate results:


_unit forceSpeed (_unit getSpeed "NORMAL"); // force the unit to run

 

 

You might also want to take a look at setBehaviourStrong.

  • Like 2

Share this post


Link to post
Share on other sites

If they're already in combat and you want to switch them back to careless, you gotta do this:

Seal_1 setBehaviour "CARELESS";
Seal_1 setCombatBehaviour "CARELESS";

And for a good measure 😅

{
  Seal_1 forgetTarget _x;
} forEach allUnits;

 

  • Like 1

Share this post


Link to post
Share on other sites
43 minutes ago, Harzach said:

 

You are telling your infantry units to run at 100 meters per second/360KMH.

 

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

 

 

You might also want to take a look at setBehaviourStrong.

 

Hah - oops - LOL - they don't really run at 100 (I would have noticed) - I'll fix it.

😁

 

I'll look at "setBehaviourStrong" as well.

 

 

 

It's so odd that it works fine on all but one unit - most of the time - then occasionally works for everyone. I can't identify what's different - on my test runs - or - the one remaining unit always left behind. It's not even Combat Mode causing this - as sometimes I just issue the "withdraw" command and I still have the remaining unit - frozen.

 

 

 

Regards,

Scott

Share this post


Link to post
Share on other sites

If you need a script for AI groups, I can recommend this script, which you can add to the activation of the waypoint from which the escape will begin.
This is code from the GoGoGo mod, but for AI groups.

IBR_ACC_AI_ANIM_SPEED_COEF = 0.2;

Ibr_AI_fn_gogogo_combat_mode =  
 { 
  params ["_units"]; 
   
  if (count _units == 0) exitWith {};   
   
  _targets = (leader (group (_units select 0))) targets [true, 1000, [], 0]; 
   {  
    (group (_units select 0)) forgetTarget _x;  
   } forEach _targets;   
     
   {      
    [_x] spawn Ibr_AI_fn_dasableAI_in_gogogo_mode;     
   } forEach _units;    
 }; 
  
Ibr_AI_fn_dasableAI_in_gogogo_mode =  
 { 
  params ["_unit"]; 
     
   { 
    _unit disableAI _x; 
   } forEach ["AUTOTARGET","AUTOCOMBAT","SUPPRESSION","WEAPONAIM"];   
   
  _speedCoef = getAnimSpeedCoef _unit; 
  _unit setSpeedMode "FULL"; 
  _mode = "BLUE"; 
  _behaviour = "AWARE"; 
   
  _unit setUnitCombatMode _mode;   
  _unit setCombatBehaviour _behaviour; 
  _unit setAnimSpeedCoef _speedCoef + IBR_ACC_AI_ANIM_SPEED_COEF; 
   
  group _unit setCombatMode _mode; 
  group _unit setBehaviourStrong _behaviour; 
   
  sleep 0.1; 
   
  waitUntil  
   { 
    _unit doTarget objNull; 
 
    !(combatMode _unit in [_mode]) 
    || 
    !(behaviour _unit in [_behaviour]); 
   }; 
   
  _behaviour = behaviour (leader group _unit); 
   
   { 
    _unit enableAI _x; 
   } forEach ["AUTOTARGET","AUTOCOMBAT","SUPPRESSION","WEAPONAIM"]; 
    
  group _unit setCombatMode "YELLOW";  
  group _unit setBehaviourStrong _behaviour; 
   
   { 
    _x setUnitCombatMode "YELLOW"; 
    _x setCombatBehaviour _behaviour; 
   } forEach units group _unit; 
    
  _unit setAnimSpeedCoef _speedCoef; 
 }; 
 
[units group this] spawn Ibr_AI_fn_gogogo_combat_mode;

Go Go Go! combat mode is terminated by changing the combat mode or behaviour.

  • Like 4

Share this post


Link to post
Share on other sites
1 hour ago, Ibragim A said:

If you need a script for AI groups, I can recommend this script, which you can add to the activation of the waypoint from which the escape will begin.
This is code from the GoGoGo mod, but for AI groups.

Go Go Go! combat mode is terminated by changing the combat mode or behaviour.

 

 

Hi Folks,

 

Hah - now that's a good share - I'll have to give that a try.

 

Appreciate the help.

 

My work is still less than satisfactory.

 

Regards,
Scott

Share this post


Link to post
Share on other sites
3 hours ago, Ibragim A said:

If you need a script for AI groups, I can recommend this script, which you can add to the activation of the waypoint from which the escape will begin.
This is code from the GoGoGo mod, but for AI groups.

Go Go Go! combat mode is terminated by changing the combat mode or behaviour.

 

Hi Folks,

 

Absolutely BRILLIANT - sir.

 

You've made it so easy for me a caveman could do it. 

 

Thank You!

 

Here's the updated test mission - if anyone is interested in a working example:

https://mega.nz/file/JswWWBpA#qNgNiV7BB6KM_MtOniFiCbtJFEUx_fosnY6DHor_BlU

 

Combat or No Combat - ALL - the troops pack up and try to get the heck out of there.

 

Nice and easy to restore everyone after the running is done.

 

This is a keeper.

 

Regards,

Scott

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

×