Crowmedic
Members
-
Joined
-
Last visited
Reputation Activity
-
Crowmedic got a reaction from SnakeDoc29 in [Addon Vehicles][Scripting][Solved]Make add-on police cars work in LSPDFRI have a custom pack that I've made which contains various add-on vehicles. My question is, what is required to make AI recognize your vehicle as a police car in order to initiate pullovers? In my meta files, I have the following settings:
- Vehicles.meta has the flags FLAG_LAW_ENFORCEMENT and FLAG_EMERGENCY_SERVICE set for each vehicle
- Carvariations.meta has <lightSettings value="1" /> and <sirenSettings value="1" /> for each vehicle as well
I also have replaced the vanilla vehicles and they are able to initiate pullovers just fine. Is there something I am missing?
EDIT: I've also confirmed through the RPH console using "Get Game.LocalPlayer.Character.IsInAnyPoliceVehicle();" and "Get Game.LocalPlayer.Character.CurrentVehicle.IsPoliceVehicle;" which both is returning True, which to me indicates that the game is at least seeing it as a police vehicle. However turning lights and sirens on does not prompt AI drivers to react appropriately, such as moving out the way of the vehicle
SOLVED: I figured out that while I had a carvariations.meta file in the mod, it was not listed in the contents.xml file for that mod. This was causing the data to not be added and resulted in the vehicles not having sirens in the base game. I run ELS and that threw me off the scent because ELS will play sirens even if the vehicle doesn't have sirens. I figured it out when "Vehicle.hasSiren" (Or whatever the method is) would return false on the vehicle. Once I found the error in content.xml, the vehicles in question began to operate properly: they could perform pullovers and traffic reacted appropriately to their sirens.