Difference between revisions of "Powered wagons"

From TTWiki
Jump to navigationJump to search
(Added sections, Example copied from NewGRFSpecs archive.)
m (Added intro.)
Line 1: Line 1:
<!--How to make trains which have powered wagons
+
How to make trains which have powered wagons
 
To write:
 
 
- settings props
 
 
- using wagon override
 
 
- provide demo download and screenshots
 
 
(Maybe:) Advanced:
 
 
- using callbacks for making not every wagon powered
 
   
***
 
-->
 
 
==Settings and properties==
 
==Settings and properties==
 
In TTD, train locomotives (engines) are powered and train wagons are not, and this is generalized, contrary to real-life trains where individual wagons might have power. The NFO action used to implement powered wagons is [http://newgrf-specs.tt-wiki.net/wiki/Action0 Action0], which defines properties for different features in TTD (trains, RVs, industries, stations etc.).
 
In TTD, train locomotives (engines) are powered and train wagons are not, and this is generalized, contrary to real-life trains where individual wagons might have power. The NFO action used to implement powered wagons is [http://newgrf-specs.tt-wiki.net/wiki/Action0 Action0], which defines properties for different features in TTD (trains, RVs, industries, stations etc.).
Line 36: Line 22:
   
 
To write:
 
To write:
 
- settings props
 
 
- using wagon override
 
   
 
- provide demo download and screenshots
 
- provide demo download and screenshots

Revision as of 22:58, 15 June 2011

How to make trains which have powered wagons

Settings and properties

In TTD, train locomotives (engines) are powered and train wagons are not, and this is generalized, contrary to real-life trains where individual wagons might have power. The NFO action used to implement powered wagons is Action0, which defines properties for different features in TTD (trains, RVs, industries, stations etc.).

If we set property 0B to any non-zero value, the wagons won't just have power when connected to engines. Instead, they start to act as engines. To make the wagons have power only when they're connected to a specific engine, property 1B has to be used. Setting the property 1B of the engine (not the wagon), defines the amount of power each wagon connected to that engine adds to the train.

Note: this works only for wagons with a Graphics override for this engine. The weight each wagon adds is defined in property 23.

Using wagon override

There is a special case of Action3, which makes the look of wagons (i.e. changes their livery) when attached to certain engines. This is called Wagon graphics override or Wagon override. This feature finds its use in train sets, when the look of wagons need to match that of engines.

When the <n-id> byte in an Action3 has bit-7 set (80 added to the actual value), all wagons in that Action3 will have wagon override and will use the graphics defined in the <def-cid> byte. The Action3 of the wagons should immediately follow the Action3 of the engine for wagon override to work, and any number of wagons can have an override for an engine.

Example

Here's an example of a passenger carriage, mail van and armoured van wagon override for the train engine with ID 28. The graphics for the engine have been defined in action 2 ID 00, those for the passenger carriage in ID 01, and mail van and armoured van use the same graphics defined in ID 02.

23 * 7 03 00 01 28 00 00 00 // engine at vehicle ID 28
24 * 7 03 00 81 1B 00 01 00 // passenger carriage ID 1B
25 * 7 03 00 82 1C 37 00 02 00 // mail and armoured carriages ID 1C, 37, respectively