• If you have a mod, tool or prefab, please use the Resources section. Click Mods at the top of the forums.

Probability of vehicle types spawning in towns

PGT666

New member
I'm working on a mod that makes the roads more dilapidated to give a more apocalypse feel to the world.   I'm making the changes in biomes.xml.  It works well adding more vehicles to clog the main roads and dry grass/shrubs/weeds starting to break through the roads.   All works well in the countryside, but in towns/cities the weeds work but vehicles don't spawn.  Is there a setting that prevents vehicles spawning on town roads?

Also I want to change the ratio of wrecked cars to good cars when they spawn.  Anyone know the setting?  Any help/hints appreciated.

 
The ratio of good cars to wrecked cars is set in blockplaceholders.xml, where it defines the eligible cars and their respective chance of spawning for the carsRandomHelper block that biomes.xml places at random in the world. The biomes code determines where there will be cars, and the blockplaceholders code decides which car to put in each spot.

For more cars on the roads, you could increase the chance of carsRandomHelper spawning in biomes.xml for each of the 3 blocks used to make roads: City Asphalt, Country Road Asphalt, and Road Gravel. They're the very last things in the biomes.xml file. You could change the chance with a Set command.

For more wrecks vs. goods cars, you would need to increase the chance of the former and decrease the chance of the latter in blockplaceholders.xml.

But there's probably an easier way if you want both more cars and specifically more wrecked cars. Create a new block (in blocks.xml) that something like MoreWrecksRandomHelper. You could probably just extend from carWrecksRandomHelper. In blockplaceholders.xml, make an entry for MoreWrecksRandomHelper that gives all the possible vehicles you want it to use. Then, in biomes.xml, append one entry to each of the three road blocks (given above) that puts your new placeholder in the pool of possibilities for things that can spawn on top of roads.

<blockontop blockname="MoreWrecksRandomHelper" prob="0.0005" rotatemax="3"/>




That's the same chance as the existing car placeholder block on City Asphalt, so you could maybe go a little higher on it.

Since cities are built up of tiles, I'm not sure that the same random scattering will be taking place in the heart of the city, but you can generate a few maps and see how it looks.

 
The ratio of good cars to wrecked cars is set in blockplaceholders.xml, where it defines the eligible cars and their respective chance of spawning for the carsRandomHelper block that biomes.xml places at random in the world. The biomes code determines where there will be cars, and the blockplaceholders code decides which car to put in each spot.

For more cars on the roads, you could increase the chance of carsRandomHelper spawning in biomes.xml for each of the 3 blocks used to make roads: City Asphalt, Country Road Asphalt, and Road Gravel. They're the very last things in the biomes.xml file. You could change the chance with a Set command.

For more wrecks vs. goods cars, you would need to increase the chance of the former and decrease the chance of the latter in blockplaceholders.xml.

But there's probably an easier way if you want both more cars and specifically more wrecked cars. Create a new block (in blocks.xml) that something like MoreWrecksRandomHelper. You could probably just extend from carWrecksRandomHelper. In blockplaceholders.xml, make an entry for MoreWrecksRandomHelper that gives all the possible vehicles you want it to use. Then, in biomes.xml, append one entry to each of the three road blocks (given above) that puts your new placeholder in the pool of possibilities for things that can spawn on top of roads.

<blockontop blockname="MoreWrecksRandomHelper" prob="0.0005" rotatemax="3"/>




That's the same chance as the existing car placeholder block on City Asphalt, so you could maybe go a little higher on it.

Since cities are built up of tiles, I'm not sure that the same random scattering will be taking place in the heart of the city, but you can generate a few maps and see how it looks.
Thanks for the excellent reply. 

I have altered the 3 roads files in biomes.xml already and it works well.  I will look into the blockholders file to adjust ratios. 

I have already run several city generations and the cars don't spawn on the roads within either a town or city, but do outside on the same roads. 

Somewhere there must be a setting that prevents it when creating a road adjoining a poi.   I will keep looking.

 
Those use tiles so they may not be affected by biome stuff like that. POIs have a property IIRC that can allow biome decoration. Not at my PC to check but you may have to edit the tiles themselves. 

 
Those use tiles so they may not be affected by biome stuff like that. POIs have a property IIRC that can allow biome decoration. Not at my PC to check but you may have to edit the tiles themselves. 
Yes, that's what I've discovered so far, with more digging into the files.  I can successfully add grass/foliage etc to automatic road generation via editing biomes.xml and this appears in towns/cities.  But not cars, although both these 'decorations' are "blockontop" items.  So I'm guessing somewhere there must be a filter that says the cars blockontop is not allowed on the road generation of tiles.  I'm going to look into block_placeholders.xml today to see if the filter is there.    I'm still hopeful as I can successfully update poi tiles on the fly with similar items to cars (blockontop), so I know I'm on the right track.

 
Back
Top