I tried to use the L.O.S behaviour, so each AI car would know each other and would avoid crashing one into another, but this won't work. I'm saying that because when i use the L.O.S behaviour in the AI cars to detect the player that is in another layer above, it works 100%. What can i do to fix this? Thank you man!!!
L.O.S is line of sight which basically uses some sort of distance(x1,y1,x2,y2) but most of times it breaks when used with pathfinder together, so my advice would be to drop L.O.S and use the expression " if distance(car.x,car.y,car.x,car.y) less or equal then 100 car stop (at this point you made your own L.O.S without the behavior and without the problems of L.O.S and Pathfinding behaviors). now i know it might seem obfuscating from our point of reading the code, but C2 actually has a background system that when you appoint the car.x, same time, basically what does, for each car that detects another instance of the same car object it applies that. you might need to add for each loop while using it. but should work, i used it on a aquarium type of game and AI ( AI used same name no numbers picking or other tricks just pure "aifish" for all different types of fishes.)worked awesome they were hunting each other and the player no confusion whatsoever in code. so that being said, i think it might work for you also. Hope you can understand my spaghetti code from above and the explanation.
Edited: ehm.... i forgot i did used a identifier i used their frames numbers. but i dont think that would help in your case let me check something il get back to you.
Edited 2: so i made this capx its not working perfect, but LOS seems to do the job pretty good here, i think the old bug is not a problem anymore, however distance it seems here is a bit frustrating to work with i can crack this when my head's clear. 11:36 pm here been up for all day, the thing with AI in general you have to code each side of car and and make it aware of its surroundings even if the cars are the same object basically, it's IID or UID picking but i can't find the expression sign for not equal so i can add it in it's some weird C2 advanced expression(not the not equal in the normal dropdown). il post in morning more for sure. i really want to fix this one, bugs my brain if not. if you're in a hurry you could try RexRainbows AI cars he has a template that has AI s racing each other and their avoiding each other however is a very complex system he has there with a lot of custom plugins if im not mistaken. (at Rex sorry for summoning you.)