Project Zomboid

Project Zomboid

Authentic Regional Police
 This topic has been pinned, so it's probably important
KapitanSWAT  [developer] 20 Mar @ 11:46am
How this mod works
Looks like it's high time I explain the system in depth, start to end (tl;dr in the last section):

Introduction
Build 42 added the following:
- "regions", which are - from a technical point of view - zones like any other, simply covering a much greater area than the usual zone; the meaning of a "zone" in this game's sense is f.e. a parking area (where cars can spawn), traffic jams, areas where zombies of specific outfit types spawn, etc.;
- profession vehicles, including regional ones like police cars - pretty self-explanatory, they're vehicles with a livery appropriate to the region they spawn in (f.e. Muldraugh, West Point, other towns/counties - see above for definition of a "region").
Seems pretty simple, right? Well, no. The system is much more than it sounds.

How the system actually works
A LUA script is in place that runs the moment the game attempts to spawn a vehicle. The script looks for the vehicle class (i.e. model, which may be f.e. a Chevalier Nyala) in a special table, and then for the region the spawning takes place in. If the script finds the vehicle's class in the table, it then proceeds to look for a defined spawn region. For each region there is a set of replacements for the vehicle class, and the game randomly picks one from a table containing all possible replacements. Unfortunately, the system doesn't allow defining weight for each replacement entry, and that's the reason I made this mod. To make it I simply added duplicate entries to those tables, thus increasing chances of specific police departments being spawned.

But how exactly does the game handle those replacements?
To put it simple: The game still only "spawns" the old, generic Chevalier Nyala and Dash Bulldriver police vehicles - nothing changed in that regard. However, as I already mentioned, the spawns get, so to say, intercepted by the new system, independent from the actual vehicle spawn table.
Basically, where in B41 you'd see the generic police vehicle spawn, you'll now see one of the new police vehicles taking its place. The new vehicles (each of them has its own vehicle class) don't actually "spawn" in the world, and without the dynamic spawn replacement you'd still only see the old, generic police cars.

So does this mod affect modded vehicles or interfere with them at all? (aka tl;dr)
Short answer: No.
Long answer: All this mod does is redefine the entries for police Chevalier Nyala and police Dash Bulldriver in the profession vehicles system, which I doubt many mods will alter. Police vehicle mod authors should still add them to the actual vehicle spawn table so that they can actually fine-tune their spawn rate. However, this "old way" means that modded police cars can't spawn as part of police roadblocks - which is something that the new system allows for, as it affects any means of spawning vehicles, including road stories.