Pathfinding help <SOLVED>

Hello I’m trying to create a tower defense game where the enemy units will keep circling the area until they are destroyed or when a certian number or enemies are spawned and the game is over. However I keep finding that the enemy units pathfinding function suddenly stop at random whenever the unit count reach 20 and higher. Can someone point out what I did wrong or how to fix this? Thanks! I have attached the code and the video of what the problem is.


Why are you moving to Path5 when your variable is both 3 and 4?

1 Like

Repeats and Trigger Once within them are finicky beasts. I suspect there’s a clash of how we think it should work, and how it actually works. Have a look at this post to possibly get an understanding of how the trigger once conditions work (it’s a bit further down the page)

You don’t need those trigger once conditions, and I suggest you get rid of them as this may solve the issue. When the conditions are met, you change both the path variable and find a new path, so on the next round of repeats those conditions won’t be true any more.


Thank you very much! Will try to implement these and see how it works. Much appreciated!

OMG! I was a bit sleepy when I did this I didn’t notice thanks for the heads up will fix it right away.

UPDATE: I followed both of your advice and it now works smoothly! Thank you very much!

1 Like