So far, it only needs one car, but I'm hoping to add a few more so you can have more than one car on the screen at once. Basically what happens is, I have a bunch of waypoints placed around the map, specifically ordered so the car will go to the correct one. It's made up of several looping paths, and the traffic car will stay on the loop it spawned on. As you drive around, the system will detect if you are a certain diatance away. Once you get that far away from it, the traffic car will respawn to the point closest to a skinmesh which is placed in front of the car (and is invisible), as long as the point is a certain distance away from the car (so you don't see it spawn). If the point is to close, the script tries again. It keeps doing this until it finds a point in the criteria (close to the player but not too close). When it spawns, it instantly goes to the next point in the loop, hence making it drive. Each time it spawns, the skinmesh changes to a random traffic car so you don't see the same one around the map. And, it has a failsafe on it, too. If the system notices that the traffic car is too far away (a certain distance), it will activate an EventTimer which resets the car every 2 seconds until it finds a point that is close enough and matches the criteria. It seems to work fluently; authough there is still a little bit of work to do on it, as it bugs out every great once in a while, and, as I said, I need to add a second one so the city doesn't seem like a place of poverty
I tried to make a city, but I have to add so many CarAI in order to make all the cars run, can you guys help me in any other way, because the vehicles are too slow and are not driving in the specified path. Any help would be appreciated.
May 22, 2016 14:22:19 GMT
Winners are not found in the so-called 'Winners' circle'. -Blades Graphics-
It takes a while to create a proper traffic system. You can't just have all of the cars spawn in at once, as that would obviously make it lag. You need to make a few cars that give the illusion of a city full of cars. It requires a lot of scripting, as well as paths placed on every road that you want a car to drive on. I'd recommend you spend the time to learn basic scripting. We have a few tutorials up on this site, and are always here to help