Jump to content
Sign in to follow this  
Drumheller

How do I stop AI from moving, but still rotate to shoot?

Recommended Posts

In ArmA 2, if I put an AI down with absolutely no waypoint, it would act as a turret and stay in the spot that I placed it without moving. This worked great for setting AI up on rooftops.

In OA, or maybe the new ZEUS, if I put AI down with no waypoints, they won't do so anymore. The second combat starts, they will start moving around, and since rooftops aren't "ground", they will just walk straight off the roof to their deaths.

I've been using this: this disableAI "move"

But then they'll only shoot in a 45 degree angle in front of themselves. I need a way to make them not move but still rotate around.

Also, on the same note, can I do the same thing with vehicles? I need a vehicle to stay in one spot behind an earthen bunker, but the second a shot is fired the damn things keep moving out from behind their bunkers. ><

Share this post


Link to post
Share on other sites

Unfortunately there's no real easy way to do this. You can disable them from moving, but that includes turning around (they can still aim, but can't move their feet). Pretty much anything that involves the AI moving their feet is considered movement.

Share this post


Link to post
Share on other sites

Are the AI units grouped with others? Try keeping them in individual groups to see if that helps. If it doesn't, try forcing them into "stealth" behavior (this will cause them to go prone, but that can be avoided by also forcing them to kneel or stand using setUnitPos). Unlike the "aware" and "safe" behaviors, "stealth" won't be automatically (and unavoidably) overwritten with "combat" behavior (which causes the AI to move around in order to "maneuver") when the shooting starts. This might keep the AI in one place for you, but I can't test it right now. Anyway, it's not hard to do, so it's worth a shot.

Share this post


Link to post
Share on other sites

I know a lame way to do it.

It's not a cool try but it will work very well

pos = getPos unit;

while {true} do {setPos Unit _pos; sleep 0.25; }

It's lame I know..

Or just a while with a if included to check if its moved.

Edited by Joshii

Share this post


Link to post
Share on other sites

Old thread, I know. But anyways. I got the same issue and the above code doesn't work for me...

When I put it in a game logic object I get a syntax error with no text. So I put it in a SQF and called that through the init.sqf

posSniper = getPos sniper;    
while {true} do {setPos sniper posSniper; sleep 0.25; }; 
posARM = getPos ARM;    
while {true} do {setPos ARM posARM; sleep 0.25; };

This looks completely fine and logical to me but it does nothing.

Share this post


Link to post
Share on other sites

you have sniper and ARM in the wrong place

in script

posSniper = getPos sniper; while {true} do {sniper setPos posSniper; sleep 0.25; };  posARM = getPos ARM; while {true} do {ARM setPos posARM; sleep 0.25; }

in logic init

null=this spawn {posSniper = getPos sniper;      while {true} do {sniper setPos posSniper; sleep 0.25; };   posARM = getPos ARM;      while {true} do { ARM setPos posARM; sleep 0.25; };}

also it sucks and the second units won't reset as the second while is never reached.

Try

sniper forcespeed 0;ARM forcespeed 0

Edited by F2k Sel

Share this post


Link to post
Share on other sites

Ah I see! Thx.

The forcespeed 0 is a good idea, but the units will move a few steps from their spot anyway, which is already too much for my case.

Share this post


Link to post
Share on other sites

I'm not seeing any movement, even if the unit is grouped and I order him to me he won't.

If he is grouped make sure Special is set to none

If you could explain how your setting it up so I can try and recreate the problem.

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  

×