Change/Add AI vehicles

help

#1

Hi !
I searched on the forums but I didn’t see anything that helped me.
Is there a way to add AI spawning vehicles ? For exemple, I want to make the HVY Cutter spawn in the streets of LS ? Is it possible ?
And, is it possible to do the same with emergency services ? For exemple, make the Police Buffalo can spawn at 3 stars ?
Thanks :slight_smile:


#2

I mean you’d have to add a large amount more to this but is this what you mean?

Citizen.CreateThread(function()
	while true do 
		Citizen.Wait(0)
		if GetPlayerWantedLevel(GetPlayerPed(-1)) > 2 then 
			local vehicle_name = "Buffalo or Whatever vehicle name goes here"
			local vehicle_hash = GetHashKey(model)
			CreateVehicle(vehicle_hash, x, y, z, heading, 1, 0) -- Insert the x,y,z and heading
		end
    end
end)

There also might be something in the FiveM source code that does this automatically. But I don’t have time to search through it all, but maybe you do.


#3

Thats not what he is talking about.

He is talking about changing the default AI traffic.

Pretty sure its in the popgroups.yml or .ymtm

Ask @Marcel-R


#4

Thanks @Knight_Marshal but it’s not what I want to do, for sure I can do like this but I think this isn’t the best way to do this.
@J.Manlet Tht’s right, popgroups.yml should work. But I don’t think this is the same file for the emergency services.