Jump to content
dbun30

disableAI "AUTOTARGET" by keyboard press.

Recommended Posts

Hi all.

I have created small script in init.sqf to execute another script when i press keyboard button, that works but i do have a question or two about what code should i put in that script when i press keyboard button.

 

I would like to disableAI "AUTOTARGET" for my entire team, also i would like to disableAI "AUTOTARGET" for individual soldier in my team by selecting that soldier first
and then hit the keyboard button (to execute script). So basically i would like to have two keyboard buttons one for disableAI "AUTOTARGET" for entire team and another keyboard button
to disableAI "AUTOTARGET" for individual soldier in my team by selecting that soldier first. So what code should i put in the script to execute when i press keyboard buttons? 

Thanks.
 

Share this post


Link to post
Share on other sites

Hi dbun30.

 

for the entire group :

{
	_x disableAI "AUTOTARGET";
	_x groupChat "Autotarget disabled";

} forEach units group player - [player];

 

for the selected units :

if (count groupSelectedUnits player > 0) then {

	{
		_x disableAI "AUTOTARGET";
		_x groupChat "Autotarget disabled";

	} forEach groupSelectedUnits player;
};

 

Works only for single player.

 

I suggest you to use only one keyboard button since you can select the entire group and disable their autotarget. In that case use only the second code.

Share this post


Link to post
Share on other sites

Thanks a lot man, it works perfectly, now i can get more deeper into some stealth missions.

Cheers!

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

×