Jump to content
theend3r

Make AI walk to an exact spot

Recommended Posts

I need the AI to get to an exact spot but they usually just go somewhere near before their WP is completed. Any way to narrow it to let's say 0.1m?

Share this post


Link to post
Share on other sites

If you need it that precise you may have to playmove an animation on him.  You can use animationState command to show you the last move animation name that is correct for his unitPos (erect, crouch, down) and weapon.  It's a pain in the ass, but possible.

Share this post


Link to post
Share on other sites

Try setWaypointCompletionRadius.

 

  • The completion radius is currently important for units moving in the Combat mode.
  • With default completion radius = 0 the leader always finishes in the exact location of the waypoint.
  • By providing a completion radius you allow him to plan his road to a cover nearby instead.
  • This does not necessarily mean the waypoint is complete once they are inside of the circle.
  • The way it works now it is complete once unit is inside and does not think it would be reasonable to move any closer.

 

Share this post


Link to post
Share on other sites

With default completion radius = 0 the leader always finishes in the exact location of the waypoint.

This is not true, most vehicles have their own min completion radius and no matter how small you set a WPs completion radius, it will always default to the vehicles min.

For MAN i believe this min is 1m.

You can tell by looking at a vehicles precision in its config e.g

MAN = 1

MRAP = 15

HELI = 100 - Although i believe helcopters have been changed some what internally and usually complete at around 150, WPs for helis are all kinds of FUBAR atm with their start stop approach to following WPs.

Place this in a waypoint completion..

systemchat str(waypointPosition[group this,(currentWaypoint group this)] distance this)
And you will see that no matter if the completion radius is set to 0 they will( depending on their speed and the timing of the engine checking for completion ) be just smaller than their config precision value.

Share this post


Link to post
Share on other sites

Thanks for all then input. I solved it by simply setPosing him there after his WP is complete. It's ugly but it works.

 

I guess the best solution would be to either use BIS_fnc_UnitCapture of just dynamically setVelocity to move him there but I'm too lazy to tinker with that now, maybe later.

Share this post


Link to post
Share on other sites

Setdirection and force him to do the normal walk animation (might need some looping and patching together different anims). Then make an invisible object and attach to. Then move the invisible object with setvelocity to where you want to go. This should work. 

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

×