So basically I’m making an AI for a zombie that basically has two modes Recon and Chase. Right now my problem is with the Recon mode. The way it works is that the map will have slected points the zombie randomly walks to, the ai will randomly select a point and walk to it, rinse and reapeat until chase mode is activated. However what’s happening is that after the first loop of doing it the Zombie breaks and freezes.
Hello, can you please provide the entire code or atleast “WalkToIdle” function code? It’s impossible to understand the problem with a little piece of code.
You’ve forgot to put “end” in condition at line 47, and also why “currentWaypointIndex” starts at 2? Also can you please give me code where you’re giving a value to variable “path”.
You should make variables such as “path” inside a function unless you need to access it at any moment in the code , and you should add a check if the path is possible. I’m only worried about that you’re not reseting “reachedEnd” variable so condition at line 41 will not let your walk to waypoint code work. Also i dont see that you’re going after every waypoint to move, You should add your currentWaypoint Index after you moved, otherwise it will start at 3rd waypoint.
It turned out that me not resetting ReachedEnd was the big problem however, I have also Implemented your other suggestions. Thank you so much for helping me fix this.