Jump to content
Sign in to follow this  
roguetrooper

How to check if A.I. tank is stuck in environment?

Recommended Posts

I have an A.I. tank roaming around in a town.

Its waypoints are at crossroads, it is setcombatmode "yellow" and setbehaviour "aware", so that it will mainly stay on the streets but fire at hostile targets it detects on its route.

Problem:

The tank is meant to move constantly and I want it not to get stuck in the environment (houses and other things it can not get over). Though it mainly keeps on the streets and drive over weak obstacles (fences etc), the tank gets stuck (driving still forward, pressing its front against an obstacle).

Is there any possibility to check if the tank is stuck?

I've tried to do it with triggers:

Execute instantly, several times
Condition: speed tank == 0
TANKSTUCK = 1;
Condition negative: TANKSTUCK = 0;

Execute after 10 seconds, several times
Condition: (speed tank == 0) and (TANKSTUCK == 1)
[] exec "tankstuck.sqf";

and the file tankstuck.sqf:

if (speed tank > 0) then { exit };
select a random [point] within 20m around the tank
tank move [point];

My intention was to check

* tank moving? speed == 0 ?

* if not moving for more than 10 seconds (since it may halt regularily on a crossroad to change direction or somewhat), then try to move to a point nearby to abort driving forward against the obstacle it cannot overcome

But it does not work. There are still situations where the tank keeps driving forward against tank-resistant obstacles.

Edited by RogueTrooper

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  

×