-->
   TrainzObjectz
A UK Company
Randomizing a Trainz Layout    

MAIN MENU
=================
Home Page

Downloads

Tutorials

KUID List

Search this Site

Other UK Content

TaFWeb Software Home Page

Text-only version of web site (suitable for page readers)





Using RandScriptz to Randomize a Layout
Next


Part 1 - The Initial Setting Up


Our layout Proteus Yard shows how it is possible to produce a layout in Trainz which is randomized, giving a different set of trains each time the layout is used. The randomization is done using our program RandConsistz. The program is controlled by a script and with the aid of another of our programs, RandScriptz, you can produce your own scripts for your own layouts. This tutorial talks you through the various stages of creating the script and randomizing your layout. You can download RandScriptz, RandConsistz and this Tutorial as a complete pack HERE.

The first stage, obviously, is to create your layout in the usual way using Surveyor. Place trackmarks at each point where you want a train to be able to start, remembering that the script can randomly choose one of several trackmarks from which a particular train will start. You may therefore wish to have more trackmarks than you will have trains. Having completed your layout, save it in the normal way.

Within the script you need to put the reference number of each trackmark. These numbers can only be determined by Trainz itself. To do this, go into Driver and, having selected your new layout, place a piece of rolling stock (it doesn't matter which piece or pieces you use) on every trackmark. Make sure that they are facing the right way! You may find it useful to make a quick sketch map of your layout and note on it the consist number you have placed at each trackmark. When you have finished placing the rolling stock, click Settings and then Save. Give the settings a name such as ProteusMarks.

Also within the script you will need to put the KUID numbers of each piece of rolling stock from which the random trains will be chosen. For most random trains you will want to be able to specify, for example, that a locomotive should be chosen from a list of locomotives, and that a particular number of wagons or coaches should also be chosen from another list or lists. Once again we will use Trainz to find out the relevant KUID numbers for us. To do this you need to create another, very simple, layout. This layout needs no landscaping and should consist of one piece of track for each of the lists you want to create (in the simplest case, like Proteus Yard, there will be two lists - one containing the locomotives and another containing the wagons). Save the layout as usual, and then (in Driver) create the necessary consists and place them on their tracks. As with the previous layout you should then save the Settings with an appropriate name (e.g. ProteusConsists). Note that it doesn't matter whether the track is long enough to contain each consist as you will never actually load this layout; it is purely for reference purposes, so don't spend a lot of time on it!

The final stage within Trainz is to set up your layout with an initial set of trains. You may not wish to randomize every train, and it is best if the trains which are not going to be randomized are created first - in Proteus Yard the shunter (switcher) is the only one not randomized and this was placed as Consist 0 - followed by the trains which represent the ones which will eventually be randomized. Save the finished Settings as usual.

You are now ready to start Creating the Script...

Other links you may find of interest:


TaFWeb Software
London, UK
E-mail:

This page URL: http://www.tafweb-trainz.co.uk/randscriptz_tutorial.html
Last major revision: 1 February 2005 at 23:08 Minor revisions: 17 January 2012 at 19:44
Site created with PageBuilder

Web page created by TaFWeb Design © 2012