Reduce NPC Traffic


#1

I was wondering what I could do to reduce NPC traffic. For no reason AI’s go crazy and start ramming other cars, mass spawn etc. I would rather not remove it but I would like to reduce it


#2

Theres a thing called traffic density in settings, you can use a native to set it for everyone.


#3

Can you dumb that down for me… .-.


#4

I quickly made a script using the native functions that cover those settings for you, which also allows you to lower the pedestrian density.

-- From 0.0 to 1.0:
trafficDensity = 0.3
pedDensity = 0.3
Citizen.CreateThread(function()
	while true do
	    SetVehicleDensityMultiplierThisFrame(trafficDensity)
	    SetPedDensityMultiplierThisFrame(pedDensity)
	    SetRandomVehicleDensityMultiplierThisFrame(trafficDensity)
	    SetParkedVehicleDensityMultiplierThisFrame(trafficDensity)
	    SetScenarioPedDensityMultiplierThisFrame(pedDensity, pedDensity)
	    
	Citizen.Wait(0)
	end
end)

Hope it helps :stuck_out_tongue: