Ai move to failing

Recently in my project everything has failed at once and I believe it has started with set max speed and Ai move failing.

The attached shows me updating the max speed dependent on if its see the pawn but it never gets updated I put a print string on the even tick to show the max walk speed and it never changes off 40 I put a break point to make sure on pawn sensing is hit and it is. I also put a print string at the end of the Ai move to on fail and it is called every time. As always any advice suggestions or further questions are appreciated

This is likely how its called more than anything else, speeds of 2000 or even more shoudnt cause any problems related to it not moving, so 400 is fine

Would have to see more to know but I think what happens here is you set the speed, the other one changes it back and then moveto is called

Assuming your in the nav mesh and stuff and it was working at one point, there dosent look to be anything wrong with the code here

make sure you handle your fail conditions or it will just stop the logic flow

the InRange check likely needs to be on tick/timer too since currently its only checking on a successful move but at that time conditions may have changed.

For more information as a test I set the max walk speed to 400 and didn’t change the value but the zombies walk in place anyway and only move very slightly I doubled checked that the max walk speed was 4 m/s.

Another issue is that when the speed is 400 the animation is meant to change to running and this isn’t happening.

The attached image shows the code bringing across the velocity and shows the cast is failing but the Boolean which is also brought across for the attacking animation is being updated correctly. Sorry if this had made it more confusing

The in range is set when event begin overlap is called and when event overlap ends it is set to false I did change it the event tick to see if it made a difference but it didn’t, thanks for the suggestion though

If somehow it’s updating one of those variables:

Use a Sequence node, off of the first have a Do once node and the castTo, promot AsZombie to a variable

Then off of the second branch of the sequence do what your doing now but use that variable AsZombie

You don’t really want to do a CastTo every animation update, just once and that reference will stay valid until that pawn is destroyed

I’d recommend looking into Behavior Trees

State Trees are easier to understand, and have default tasks for move to or delay.

1 Like

Didnt even realize those were a thing, ill have to play with them a bit! Thank you for additional knowledge

Found the culprit from another forum in 2014 lmao,


Thanks for the help anyways having to move the AI to a behaviour tree was probably the next move if anyone else finds this.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.