Forum Mod Bakery Docs

Adding more traffic

Please login to contribute to the conversation.
If you ended up here, you're either new or a bit confused about the docs. That's ok!
In this tutorial I will explain how to add more traffic to your level scripts. (assuming you have already set up your own mod)

Configuring Custom Traffic Support:
First thing you want to add to your mod is Custom Traffic Support (check this page for documentation).
What you are looking to change here, are the following:
<PreallocatedCars Amount="5" />
	
<AllocatedCars Amount="5" />
	
<MaxTraffic Amount="5" />
<MaxTrafficOnFoot Amount="5" />
Change these from 5 to whatever number you want (in this example, 10)
<PreallocatedCars Amount="10" />
	
<AllocatedCars Amount="10" />
	
<MaxTraffic Amount="10" />
<MaxTrafficOnFoot Amount="10" />
When you're pleased, make sure to save your file.

Configure Level Scripts:
Open the script folder of the level you're trying to edit (for example scripts\missions\level01\) and look for the following files:
  • level.mfk
  • leveli.mfk

Open the first one with any text editor & find the lines that load the traffic models:
// Traffic vehicle models
//
LoadP3DFile( "art\cars\huskA.p3d" );
LoadP3DFile( "art\cars\pickupA.p3d" );
LoadP3DFile( "art\cars\glastruc.p3d" );
LoadP3DFile( "art\cars\schoolbu.p3d" ); // sedanA
LoadP3DFile( "art\cars\minivanA.p3d" );
//LoadP3DFile( "art\cars\compactA.p3d" );
//LoadP3DFile( "art\cars\sportsA.p3d" );
//LoadP3DFile( "art\cars\SUVA.p3d" );
Now, disable the comments down below, or add your own lines:
// Traffic vehicle models
//
LoadP3DFile( "art\cars\huskA.p3d" );
LoadP3DFile( "art\cars\pickupA.p3d" );
LoadP3DFile( "art\cars\glastruc.p3d" );
LoadP3DFile( "art\cars\schoolbu.p3d" ); // sedanA
LoadP3DFile( "art\cars\minivanA.p3d" );
LoadP3DFile( "art\cars\compactA.p3d" );
LoadP3DFile( "art\cars\sportsA.p3d" );
LoadP3DFile( "art\cars\SUVA.p3d" );
LoadP3DFile( "art\cars\ship.p3d" );
Now save your file & open the other one.
Search the traffic group initialization block & add your new cars:
//ADDING TRAFFIC GROUP FOR LEVEL 01//
//
CreateTrafficGroup( 0 );
AddTrafficModel( "minivanA",2 );
AddTrafficModel( "glastruc",1,1 );
AddTrafficModel( "schoolbu",1,1 );
AddTrafficModel( "pickupA",1 );

// optional: make sure it amounts to whatever number you set (10 in this example)
AddTrafficModel("ship", 2);
AddTrafficModel("compactA", 1);
AddTrafficModel("sportsA", 1);
AddTrafficModel("SUVA", 1);
CloseTrafficGroup( );
//
Once you're there, make sure to save your file.
And there you have it! Now open your game & check out the new cars on your traffic!