HowTo/Add Carz Traffic to a Route

From TrainzOnline
Jump to: navigation, search

Contents

Adding Car Traffic to a Route

There are two ways to add carz to routes to enable them for traffic. Both involve adding lists of kuids for carz to config.txt files.

Trainz reads the car0, car1, car2 etc tags in the route config.txt and the region config.txt specified for that route, to build a list of carz to randomly spawn onto the roads that are traffic enabled.

Adding Carz to a Route Using a Region

If you have a route that has no region specified you can add a car enabled region by just adding/editing the region tag in the config.txt. Before adding the region, open it in Content Manager and inspect the config.txt. It should have a list of car entries starting a car0 and be an unbroken incremented list car0, car1, car2, etc. If there is a gap in the car numbering the car number before the gap will be the last car added. Those following the gap will be ignored.

An example of the config.txt of kind "region":-


username           "Queensland Region"
kuid               <kuid:XXXXXX:YYYY>
category-region    "AU"
category-era       "1970s;1980s;1990s;2000s;2010s"
kind               "region"
watercolor         154,104,53
defaultjunction    100633
ontheright         0
longitude          153,2,1
latitude           27,28,-1
altitude           0
car0               <kuid:329364:1514>   .............kuid of car best obtained by using CCP
car1               <kuid:60238:29>
car2               <kuid:60238:33>
   without any gaps in the car# list up to
car13              <kuid:-1:100527>
car14              <kuid2:329364:1189:2>
car15              <kuid:-1:36>
category-class     "YX"
trainz-build       2.9
thumbnails
{
  0
  {
    image          "qld_region.jpg"
    width          240
    height         180
  }
}
kuid-table
{
           all the kuid's above except for the kuid of this asset
}

The carz to be added need to be the latest type with a trackside tag to work in TS2010 or TS12, refer to HowTo/Build a Car for Traffic (stand-alone version)

If your region has a car list then it can be used to add those carz to a route by adding the region tag to the route's config.txt as follows:-

region     <kuid:XXXXXX:YYYY>     ..............the kuid of your region
carrate    4                      ..............an integer 3 to 50 in value to control
                                                the delay between cars being spawned
                                                (smaller value means more carz)
ontheright 1                      ..............for countries where we drive on the
                                                 right hand side of the road

Adding Carz to a Route Directly

You can add a car list to a route to either enable cars or add more cars than specified in the region. Again the list must be an unbroken list starting at car0.

Here is the config.txt of a test route used to test the carz in the list.


region                                  <kuid:-1:7801>
category-era                            "1800s"
category-class                          "ZX"
category-region                         "00"
car0                                    <kuid:329364:1574> 
car1                                    <kuid:329364:1575>
car2                                    <kuid:329364:1576>
car3                                    <kuid:329364:1577>
car4                                    <kuid:329364:1578>
car5                                    <kuid:329364:1579>
car6                                    <kuid:329364:1565>
car7                                    <kuid:329364:1569>
car8                                    <kuid:329364:1558>
kuid                                    <kuid:329364:100020>
kind                                    "map"
username                                "Test"
workingscale                            0
workingunits                            0
water                                   <kuid:-1:6342>
description                             
trainz-build                            3.3
world-origin
{
  latitude                              27,28,-1
  longitude                             153,2,1
  altitude                              0
}
string-table
{
}
kuid-table
{
}


Content Creator Plus (CCP) is the easy way to add carz to the route. Note that the carz must be category-class "VL" (land vehicles) for this to work.

From Content Manager select Edit in Content Creator Plus and CCP will open.


AddingCarz001.jpg


Right Click on Map in the top left corner of the program window to open a pop-up menu.


AddingCarz002.jpg


From the menu select car0. An empty car0 entry will appear in the RHS pane of the CCP window.


AddingCarz003.jpg


Left Click on the Browse button (3 dots on the button). The KUID Browser will open displaying a list of "scenery" items. Unfortunately there is a bug in CCP so only built-in items are listed. Click on the arrow next to "scenery" and select "(automatic)" from the drop down list. (It's at the top of the list) The list will now contain all appropriate assets installed in the asset database.


AddingCarz004.jpg


Select a car from the KUID Browser list. It will appear as car0 in the RHS pane of CCP.

Note that when we right click on the Map entry there is NO car selection on the pop-up menu. A little creative thinking is needed here.

Save and close the route from CCP.

Then from Content Manager, select the route and from the right click menu select Edit in Explorer and open the config.txt in NotePad. Find the car0 entry and add empty car entries as follows:-

car0       <kuid:XXXXX:YYYY>
car1
car2
car3
car3
car4
etc for the number of carz you desire.

Save and Close from NotePad.

In Content Manager select Edit in Content Creator Plus and CCP will open again.

This time we will have empty car# entries that can be populated with the KUID Browser as above.


AddingCarz005.jpg


When done save and close from CCP.

The route will now be ready to use with traffic.

Note that the same CCP procedure can be used to add the car list to a region.

If you do not add a "carrate" entry to the route config.txt, the game will use the default value of 5.

If you do not add a "ontheright" entry to the route config.txt, the game will use the default value of 0 (boolean false); meaning the carz will drive on the LHS of the roads as in UK, Australia, Japan etc.


Return to How To Index

HowToGuides

Personal tools