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

DisableAI enumeration?

Recommended Posts

Hi,

I'm currently working on some kind of headquarters, and I'm going to make it seem alive by placing units who play animations. To make them stay in place, I wanna disable their AI:

actor1 disableAI "ANIM";
actor1 disableAI "MOVE";
actor1 disableAI "FSM";
actor1 disableAI "AUTOTARGET";
actor1 disableAI "TARGET";

actor2 disableAI "ANIM";
actor2 disableAI "MOVE";
actor2 disableAI "FSM";

I was wondering: Is it possible to do some kind of enumeration, like this?

{actor1, actor2} disableAI ["ANIM", "MOVE", "FSM", "AUTOTARGET", "TARGET"];

To make the code more compact?

Thanks in advance.

Share this post


Link to post
Share on other sites

One method could be to place the name of all of the actors into an array and then use the forEach command to loop through each actor to execute each disableAI command:

_hqActors = [actor1, actor2];
{_x disableAI "ANIM";  _x disableAI "MOVE";  _x disableAI "FSM";  _x disableAI "AUTOTARGET";  _x disableAI "TARGET"} forEach _hqActors;

There are also examples to use "units group" if all of the units are in the same group instead of placing the names into a separate array.

Edited by Loyalguard
array syntax typo

Share this post


Link to post
Share on other sites

Thanks for the fast reply.

Tried what you said, and works perfectly fine. Many thanks.

-> Solved

Share this post


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

×