Jump to content
georgischer Maschinengewehr

make (force) Ai stay in building

Recommended Posts

  usually I put AI in buildings (ungrouped) and I set their stance to "stand up" 

because group leader orders them different commands and then AI leaves its position

but even if I set ai in a building, they are standing "normally" but when they engage hostile, they go out of the building.

 

9b799163edc6.jpg
 

 

any chances to put A GROUP or AI in a building and defend this goddamn building without leaving? 

Share this post


Link to post
Share on other sites

this forcespeed 0;

 

Will keep unit from moving also.

 

And I highly recommend Zenophon's occupy building script.  It does all the placement work for you (finds buildings near units, finds positions in and on top of buildings, places units, faces them out (so looking out window or doorway), and even calls my JBOY Up Down script on them when a FiredNear event occurs.

Share this post


Link to post
Share on other sites

Grumpy Old Man

thanks a million! 

 can I try using this in a group as well? or only for single units. (ungrouped) 

For groups you could use this in the init field of one group member (can be any unit):

{
doStop _x;
_x disableAI "PATH";
} foreach units group this;
group this enableAttack false;

Or you might take a look into what johnnyboy suggested.

this forcespeed 0;

is also a good suggestion, can be reset by using -1.

 

 

Cheers

Share this post


Link to post
Share on other sites

this forcespeed 0;

 

Will keep unit from moving also.

I'd been relying on this for a while to keep ai in place. But a week or so ago i had a fire team positioned behind a VCP with the group leader in a building nearby. The VCP lot stayed in place initially, but on contact with enemy most of the time they'd start moving again. Not sure why that was happening.

Share this post


Link to post
Share on other sites

I'd been relying on this for a while to keep ai in place. But a week or so ago i had a fire team positioned behind a VCP with the group leader in a building nearby. The VCP lot stayed in place initially, but on contact with enemy most of the time they'd start moving again. Not sure why that was happening.

 

I always used this in the past A2 onwards, other people said they would still move but not for me.

But like you a few  weeks ago I had some start moving when engaged.

 

I just checked again by placing around twenty units in and out of buildings at it seems fine again.

 

there is also  this disableAI "path"

  • Like 1

Share this post


Link to post
Share on other sites

I ended up disabling "PATH" and it worked out. Glad that one was an easy fix.

Share this post


Link to post
Share on other sites

I ended up disabling "PATH" and it worked out. Glad that one was an easy fix.

After some further testing and goofing around disableAI "PATH" should actually be the only command needed to keep a unit from moving but still being able to turn, target and fire.

 

Cheers

  • Like 1

Share this post


Link to post
Share on other sites

If you freeze units like that, do put them back in a group. Having lots of "ungrouped" units (many small groups) is usually bad for performance.

  • Like 1

Share this post


Link to post
Share on other sites

thanks a lot everyone!!!

 

For groups you could use this in the init field of one group member (can be any unit):

{
doStop _x;
_x disableAI "PATH";
} foreach units group this;
group this enableAttack false;

it worked great for me! 

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

×