Jump to content
Sabre99

forceFollowRoad script makes AI move weird.

Recommended Posts

I need to enemy tank stay on roads. So I put " this forceFollowRoad ture; " script on it. However, this causes problem on AI behavior.

Tanks are won't moving. Plus, they just wiggling and spinning around.

How can I fix this?

Share this post


Link to post
Share on other sites

Better skip that command and set their behaviour to SAFE on the editor or apply to the group.

this setBehaviourStrong "SAFE";
  • Like 1

Share this post


Link to post
Share on other sites

"CARELESS" and "SAFE" are 2 behaviors for units reaching and following the roads each time it's possible.

But "SAFE" can fall into "COMBAT" if needed, even with setBehaviourStrong...

 

So, your best bet is to write:

driver yourTank setCombatBehaviour "CARELESS";

This way you can set "CARELESS" to driver only, he'll follow the roads. Meanwhile gunner and commander can fall into "COMBAT" and engage targets.

 

  • Like 4

Share this post


Link to post
Share on other sites

make the driver an agent

Share this post


Link to post
Share on other sites

you could add a eventhandler that detects when the tank gets really close to the edge or just outside of the nearest road, which is probably what its on... 
https://community.bistudio.com/wiki/isOnRoad

or https://community.bistudio.com/wiki/BIS_fnc_nearestRoad

but I have no clue about BIS_fnc 
so I'd use https://community.bistudio.com/wiki/nearRoads ... get the road and info 
https://community.bistudio.com/wiki/getRoadInfo


...determine the difference between your units and the center of the road... not sure what that works too... 

but I'd probably use the nearRoads function again and again... 
and as they say... determine the AIs behavior, but try to keep them running without much change. 
However getting them on a waypoint is another great deal as well... you want the next segment of the road in the array...
Everytime they start getting lose or near the edge... you pop their waypoints. But you gotta look ahead so you feed the next segment again. 
 

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

×