Jump to content
Sign in to follow this  
edstraker

Getting Ai unit to Banzai charge ?

Recommended Posts

Hi,I'm sorry if this has been asked before but I really want to get to grips with this,so if it has please excuse me.Although I have had Arma 3 for sometime,I am desparate to get my opposing Ai troops to Banzai Charge,ie to make an all running out charge at my chosen side's line within a editor mission I am building,regardless of them being killed in the process.

 

They just seem to just fanny about,and even when running across say a field,every now and then they'll pause,which just doesn't look realistic.At present in the editor I am using Move,Aware,Full Speed,Open Fire etc as my command.

 

Is there a way to get them to keep on running at the target opposition even when they are under fire?

 

My mission is using WW2 Marine Corps vs Imperial Japanese Infantry,so I want the Japanese to Banzai in classic style,maybe I'm asking too much of the Arma 3 module,if I am please tell me.

 

Any help or advice would be warmly appreciated,thanks

Share this post


Link to post
Share on other sites

This makes a unit charge to the next waypoint, no matter if under fire or not as long as there's a waypoint:

{this disableAI _x} foreach ["AUTOCOMBAT","TARGET","AUTOTARGET","SUPPRESSION","COVER"];

The unit will not fire back under any circumstance, to revert the changes simply copy the above line and replace disableAI with enableAI.

 

Cheers

  • Like 1

Share this post


Link to post
Share on other sites

Thanks very much for your help Grumpy Old Man,as a complete noob,where should I be putting this data,do I put it in the waypoint init that the unit is going to ?

Share this post


Link to post
Share on other sites

For ease of use you could put this into init.sqf:

EDstraker_fnc_setBanzaiMode = {

	params ["_unit",["_enable",false]];

	if (_enable) exitWith {
	
		{_unit disableAI _x} foreach ["AUTOCOMBAT","TARGET","AUTOTARGET","SUPPRESSION","COVER"];
		_unit setbehaviour "AWARE";//in case unit is already in combat
		
		true
	};

	{_unit enableAI _x} foreach ["AUTOCOMBAT","TARGET","AUTOTARGET","SUPPRESSION","COVER"];
	true
};

This defines the function. Now every time you want a unit to charge to its next waypoint use this:

 

_banzai = [YourUnitName,true] call EDstraker_fnc_setBanzaiMode;

To make the unit using default behavior again:

_banzai = [YourUnitName] call EDstraker_fnc_setBanzaiMode;

You can put this anywhere you want. Init field, trigger, etc.

 

 

Cheers

Share this post


Link to post
Share on other sites

Wow,thanks Grumpy Old Man,this is great,I'll try it out tonight !

  • Like 1

Share this post


Link to post
Share on other sites
On 8/25/2017 at 4:14 AM, Grumpy Old Man said:

For ease of use you could put this into init.sqf:


EDstraker_fnc_setBanzaiMode = {

	params ["_unit",["_enable",false]];

	if (_enable) exitWith {
	
		{_unit disableAI _x} foreach ["AUTOCOMBAT","TARGET","AUTOTARGET","SUPPRESSION","COVER"];
		_unit setbehaviour "AWARE";//in case unit is already in combat
		
		true
	};

	{_unit enableAI _x} foreach ["AUTOCOMBAT","TARGET","AUTOTARGET","SUPPRESSION","COVER"];
	true
};

This defines the function. Now every time you want a unit to charge to its next waypoint use this:

 


_banzai = [YourUnitName,true] call EDstraker_fnc_setBanzaiMode;

To make the unit using default behavior again:


_banzai = [YourUnitName] call EDstraker_fnc_setBanzaiMode;

You can put this anywhere you want. Init field, trigger, etc.

 

 

Cheers

Sorry, i am trying to do the same thing but am very new to the editor, where exactly do i put "_banzai = [,true] call EDstraker_fnc_setBanzaiMode;"

and what do I put in for "YourUnitName." Do I put the designation of the squad, alpha 6-2, or the name of the unit type, which would b e "Trooper." (Am using starwars mod)

Share this post


Link to post
Share on other sites
2 hours ago, Sarge.. said:

Sorry, i am trying to do the same thing but am very new to the editor, where exactly do i put "_banzai = [,true] call EDstraker_fnc_setBanzaiMode;"

and what do I put in for "YourUnitName." Do I put the designation of the squad, alpha 6-2, or the name of the unit type, which would b e "Trooper." (Am using starwars mod)

With scripting it's best to take things literally, so if something says "YourUnitName" it doesn't mean squad designation, heh.

Usually refers to the variable name you're giving a unit inside the editor:

  1. Right Click on Unit
  2. Attributes...
  3. Object Init: Variable Name

You can put the function call into a trigger, script or basically anywhere you seem fit.

 

Cheers

Share this post


Link to post
Share on other sites

so could I just put it in a waypoint's attributes at 

 

1. Waypoint:expression

2. On activation

 

Or do i have to figure out how to use triggers?

 

Or should I just stop asking questions and watch some tutorials?

 

 

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
Sign in to follow this  

×