How do I make bots (running into walls bug)?

How do I make a bot detect a surface so that when a surface is detected it triggers the bot to turn around a certain amount until an enemy player crosses its line of sight.

After that, how do I make the bot then chase this target until I suppose it hits another wall?

I don’t have much experience with bots but “Ray Cast Hit Position” should detect walls. It works basically like hitscan where you give it a start and end position and it returns the position of the first thing it hits.

So lets say your start position is that of the bot and end position is 100 units ahead of him. If you chose it to ignore all players and player objects it will give you the location of the first wall the ray hits.

If you put a condition of said location being too close to your bot you can then make an action for it to do once that happens.

Additionally, distance between(nearest walkable position(world vector of(throttle of(event player), event player, rotation and translation)), world vector of(throttle of(event player), event player, rotation and translation)) >= 0.2 can help you to detect cliffs.

If you want to lower or increase the detect range you have to work with add(multiply(world vector of(throttle of(event player), event player, rotation), *number*), position of(event player)) instead.