Jump to content
Sign in to follow this  
Halt

Prevent a Unit From Moving.

Recommended Posts

Hey, I know this has been asked earlier but I have a major issue.

With the disableAI "MOVE" command, they cannot actually move

their line of sight, nor their arc of fire. I need this AI Sniper on a

roof to NOT run off and fall to his death, while still sniping the enemies.

Share this post


Link to post
Share on other sites
try dostop this in the init line of the unit

I've already tried, he still thinks a fall from the building

would be enjoyable. :(

Share this post


Link to post
Share on other sites

Sounds like the building you're trying isn't properly built for walking/standing on. Placing an AI unit at a buildingPos and using doStop usually works fine for me. Other than doStop there's no way to force him to not move without disabling them from turning. They can still aim a bit however, about 30 degrees left & right, but I guess that doesn't help you.

Share this post


Link to post
Share on other sites

This is what I use in a unit creation/placing it in a static position function:

_unit disableAI "AUTOTARGET";
[_unit] spawn { doStop (_this select 0) };

Works perfectly for me

Share this post


Link to post
Share on other sites

You could also try setposition command.

this setPos (nearestBuilding this buildingPos 3)

The number 3 indicates the pos inside or on the building. You just gotta figure out what is the right position on the roof.

yesterday I play tested a mission of mine where I used the setposition code and it works perfectly the unit doesn't move but will shoot if he spots an enemy.

Kind regards

Share this post


Link to post
Share on other sites
You could also try setposition command.

this setPos (nearestBuilding this buildingPos 3)

The number 3 indicates the pos inside or on the building. You just gotta figure out what is the right position on the roof.

yesterday I play tested a mission of mine where I used the setposition code and it works perfectly the unit doesn't move but will shoot if he spots an enemy.

Kind regards

The advantage of using buildingPos's are that if the AI does decide to move, he will properly exit the building rather than just running off the roof. Otherwise it's typically not a good idea to place an AI somewhere on a building that's not a buildingPos.

Share this post


Link to post
Share on other sites

Thanks for all the help, I'll get to trying them soon.

---------- Post added at 12:00 AM ---------- Previous post was Yesterday at 11:50 PM ----------

Well, I've decided to scrap the buildings

and just make difficult patrols and guards on the

streets. Another issue. I have the terrorist standing

around, I have an unarmed soldier as a test, run past

him. As soon as he sees the soldier, he runs to cover

and fires at him. But doesn't return back to his spot

and proceeds to wander aimlessly until he is either

killed or on the other side of the map.

Oh and as soon as somebody fires, every single patrol

has a fit and decides to run amok looking for people

to kill, which I don't want. I would prefer if they would

just stay in their patrol, or look for a target for only a

certain time.

Edited by Halt

Share this post


Link to post
Share on other sites

this forcespeed 0 works for your sniper idea, ive used it myself tons of times. You do however have to use the setpos command to set the height.

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  

×