Traffic Issue [Mass Spawn]

Dear players / viewers,

One of the biggest issues we have faced ((in our server, LA:RP)) for a prolonged period of time now has been the AI Traffic. The traffic is tedious, mass spawning, it is just plain out chaos. AIs in vehicles, spawn above players and from time to time, out of a sudden, in front of them. We thought maybe it was due to latency however, that does not seem to be the case nor does it seem like any “lag” evolves around this issue. Any help would be appreciated. We have tried several scripts, custom coded a traffic script, neither worked.

SetVehicleDensityMultiplierThisFrame
SetRandomVehicleDensityMultiplierThisFrame

The above is what was used in the script made in hopes of fixing it, however, like how it always goes, the other way around. Didn’t work.

Regards,
Dashie

1 Like

Are you sure you implemented those correctly?

Because they definitely should reduce the traffic if you set it to 0.5 for example.
I’ve used those in my vBasic script and they work perfectly fine. Although setting them to 0.0 would not remove ALL vehicles but there are almost one left :wink:

I can’t tell you for sure if it was implemented correctly, however, i will get in touch with my Developer and get him to overview the code once more. He stated that, when he set the traffic to 0.0, there was no vehicles at all. So uhm, yeah haha.

0.0 will actually set ‘traffic’ to 0, which disables normal traffic. But special scenarios like AI getting in cars and driving off, or parking their cars and getting out to walk will still exist. That’s why you still might see some random cars around.

Also those methods need to be called every frame (so in a while true do loop with a Citizen.Wait(0)).

Alright, do you think any other factors would play in if let’s say it was coded correctly but there are still issues with the traffic spawn / flow ?

Not sure, sometimes depends on how many clients are in a specific area.

What we have noticed is that; The more clients there are clustered at that particular area, the worse the traffic gets for that particular area. So i guess, that inference is correct. However, appreciate the help. I will get back to you not too long from now to update you on it.

1 Like

They are implemented correctly (called each frame in a client script). I think the problem was explained the wrong way. The “traffic” density is setting correctly. The issue isn’t with the density. Regardless of how many vehicles are on the streets at any given time, when a large number of players gather in a single area, say spawn or PD for example, vehicles will start to spawn above the groups and cause massive explosions / chaos. It happens no matter what the traffic density is set at (unless it’s disabled, of course). To make it more difficult to track, it doesn’t always happen. And no scripts that I have wrote would cause erroneous car spawning.

It’s a strange issue that I have had no luck resolving. Anyway, thanks for any assistance.

1 Like

so i have a basic idea of how u could fix this mayybe, from what itt looks like, the densitty is applieed to eeach player in the area instetad of thee server so when there is more players in a certain area tthere is more ttraffic there fucking shitt up.

what i would do is create a citizen function which constantly checks for each player if there is more than 1 player around him lets say a area of a 100 coords and if there is more than 1 player in that area then u set the density multiplier lower and if there isnt then u set it to normal, hope u understand what i mean

Yeah I understand what you mean, sounds like it should work. I’d say make it and see if it works :slight_smile:

yeah im not gonna make it, i aint got time for that XD

He meant me, Cosharek, not you haha. Thanks I’ll see what happens.

Any fix? I have this problem to :frowning:

1 Like

Still need a fix for this? Happens when more than like 5 people in one area.

1 Like

any update on this?