Difference between revisions of "Action0/Vehicles/Trains"
Planetmaker (talk | contribs) (fix tables and stuff lost in conversion) |
|||
(65 intermediate revisions by 7 users not shown) | |||
Line 1: | Line 1: | ||
+ | <div style="float:right; padding-left:12px; background:none;">{{NFONavVehicles}}</div> |
||
+ | |||
=Introduction= |
=Introduction= |
||
− | |||
− | Action 0 - Properties for train vehicles |
||
− | |||
Defining properties of train vehicles. |
Defining properties of train vehicles. |
||
+ | = Properties = |
||
− | {maketoc} |
||
− | |||
− | =Properties= |
||
{| |- |
{| |- |
||
− | !Number!! |
+ | !Number!![[GRFActionsDetailed|Size]]!!Version!!Description!!Available for articulated parts |
|- |
|- |
||
− | |05|| |
+ | |05||B||{{ottdp|0.6|2.0}}||Track type (see below)||should be same as front |
|- |
|- |
||
− | |08|| |
+ | |08||B||{{ottdp|0.6|2.0}}||AI special flag: set to 1 if engine is 'optimized' for passenger service (AI won't use it for other cargo), 0 otherwise||no |
|- |
|- |
||
− | |09|| |
+ | |09||W||{{ottdp|0.6|2.0}}||Speed in mph*1.6 (see below)||no |
|- |
|- |
||
− | |0B|| |
+ | |0B||W||{{ottdp|0.6|2.0}}||Power (0 for wagons)||should be zero |
|- |
|- |
||
− | |0D|| |
+ | |0D||B||{{ottdp|0.6|2.0}}||Running cost factor (0 for wagons)||should be zero |
|- |
|- |
||
− | |0E|| |
+ | |0E||D||{{ottdp|0.6|2.0}}||Running cost base, see below||should be zero |
|- |
|- |
||
− | |12|| |
+ | |12||B||{{ottdp|0.6|2.0}}||Sprite ID (FD for new graphics)||yes |
|- |
|- |
||
− | |13|| |
+ | |13||B||{{ottdp|0.6|2.0}}||Dual-headed flag; 1 if dual-headed engine, 0 otherwise||should be zero also for front |
|- |
|- |
||
− | |14|| |
+ | |14||B||{{ottdp|0.6|2.0}}||Cargo capacity||yes |
|- |
|- |
||
− | |15|| |
+ | |15||B||{{ottdp|0.6|2.0}}||Cargo type, see [[CargoTypes]]<br/> |
+ | {{grfTill|7}} For GRF version 7 and below: Type B 'cargo slot'<br/> |
||
+ | {{grfFrom|8}} For GRF version 8 and above: Type A '(translated) cargo bit'<br/> |
||
+ | {{ottd|15.0}} Since 15.0, a default cargo translation table corresponding to the climate is used if one is not provided. |
||
+ | ||yes |
||
|- |
|- |
||
− | |16|| |
+ | |16||B||{{ottdp|0.6|2.0}}||Weight in tons||should be zero |
|- |
|- |
||
− | |17|| |
+ | |17||B||{{ottdp|0.6|2.0}}||Cost factor||should be zero |
|- |
|- |
||
− | |18|| |
+ | |18||B||{{ottdp|<0.7|2.0}}<ref>This property is not used by OpenTTDs NoAI API.</ref>||Engine rank for the AI (AI selects the highest-rank engine of those it can buy)||no |
|- |
|- |
||
− | |19|| |
+ | |19||B||{{ottdp|0.6|2.0}} {{grfFrom|1}}||Engine traction type (see below)||no |
|- |
|- |
||
− | |1A |
+ | |1A||B/B*<ref>{{ottdp|0.7|no|ottdrev=r13831}} Since OpenTTD r13831 this is an extended byte.</ref>||{{ottdp|0.6|2.0}} {{grfFrom|1}}||Not a property, but an action: sort the purchase list.||no |
|- |
|- |
||
− | |1B||6|| |
+ | |1B||W||{{ottdp|0.6|2.5}} {{grfFrom|6}}||Power added by each wagon connected to this engine, see below||should be zero |
|- |
|- |
||
− | |1C||6|| |
+ | |1C||B||{{ottdp|0.6|2.5}} {{grfFrom|6}}||Refit cost, using 50% of the [[BaseCosts|purchase price cost base]]||yes |
|- |
|- |
||
− | |1D||6|| |
+ | |1D||D||{{ottdp|0.6|2.5}} {{grfFrom|6}}||Bit mask of cargo types available for refitting, see column 2 (bit value) in [[CargoTypes]]. <b>Obsoleted by properties 2C/2D</b>||yes |
|- |
|- |
||
− | |1E||6|| |
+ | |1E||B||{{ottdp|0.6|2.5}} {{grfFrom|6}}||Callback flags bit mask, see below||yes |
|- |
|- |
||
− | |1F|| |
+ | |1F||B||{{ottdp|0.6|2.5|ttdprev=alpha 19}}||Coefficient of tractive effort||should be zero |
|- |
|- |
||
− | |20|| |
+ | |20||B||{{ottdp|1.1|2.5|ttdprev=alpha 27}}||Coefficient of air drag||should be zero |
|- |
|- |
||
− | |21|| |
+ | |21||B||{{ottdp|0.6|2.0}} {{grfFrom|2}}||Make vehicle shorter by this amount, see below||yes |
|- |
|- |
||
− | |22||6|| |
+ | |22||B||{{ottdp|0.6|2.5}} {{grfFrom|6}}||Set visual effect type (steam/smoke/sparks) as well as position, see below||yes |
|- |
|- |
||
− | |23||6|| |
+ | |23||B||{{ottdp|0.6|2.5}} {{grfFrom|6}}||Set how much weight is added by making wagons powered (i.e. weight of engine), see below||should be zero |
|- |
|- |
||
− | |24|| |
+ | |24||B||{{ottdp|0.6|2.5|ttdprev=alpha 44}}||High byte of vehicle weight, weight will be prop.24*256+prop.16||should be zero |
|- |
|- |
||
− | |25|| |
+ | |25||B||{{ottdp|0.6|2.5|ttdprev=alpha 44}}||User-defined bit mask to set when checking veh. var. 42||yes |
|- |
|- |
||
− | |26|| |
+ | |26||B||{{ottdp|0.6|2.5|ttdprev=alpha 44}}||Retire vehicle early, this many years before the end of phase 2 (see [[Action0General]])||no |
|- |
|- |
||
− | |27|| |
+ | |27||B||{{ottdp|0.6|2.5|ttdprev=alpha 58}}||Miscellaneous flags||partly |
|- |
|- |
||
− | |28|| |
+ | |28||W||{{ottdp|0.6|2.5|ttdprev=alpha 58}}||Refittable cargo classes||yes |
|- |
|- |
||
− | |29|| |
+ | |29||W||{{ottdp|0.6|2.5|ttdprev=alpha 58}}||Non-refittable cargo classes||yes |
|- |
|- |
||
− | |2A|| |
+ | |2A||D||{{ottdp|0.6|2.5|ottdrev=r7191|ttdprev=r1210}}||Long format introduction date||no |
− | |} |
||
− | |||
− | Version codes: |
||
− | |||
− | {| |- |
||
− | !Code!!Version |
||
|- |
|- |
||
+ | |2B||W||{{ottdp|1.2|no|ottdrev=r22713}}||Custom cargo ageing period||yes |
||
− | |(a)||2.0.1 alpha 19 |
||
|- |
|- |
||
+ | |2C||B n*B||{{ottdp|1.2|no|ottdrev=r23291}}||List of always refittable cargo types||yes |
||
− | |(b)||2.0.1 alpha 27 |
||
|- |
|- |
||
+ | |2D||B n*B||{{ottdp|1.2|no|ottdrev=r23291}}||List of never refittable cargo types||yes |
||
− | |(c)||2.0.1 alpha 44 |
||
|- |
|- |
||
+ | |2E||W||{{ottdp|12|no|ottdrev=g2183fd4dab}}||Maximum curve speed modifier||yes |
||
− | |(d)||2.0.1 alpha 58 |
||
|- |
|- |
||
+ | |2F||W||{{ottdp|13|no}}||Vehicle variant group||no |
||
− | |(e)||2.5 r1210, OpenTTD r7191 |
||
|- |
|- |
||
+ | |30||D||{{ottdp|13|no}}||Extra flags||?? |
||
− | |(f)||OpenTTD r13831 |
||
+ | |- |
||
+ | |31||B||{{ottdp|14|no|ottdrev=g2d73076056}}||Additional callback flags bit mask, see below||yes |
||
+ | |- |
||
+ | |32||W||{{ottdp|15|no|ottdrev=gd2496b6ec4}}||Cargo classes required for refittability||yes |
||
|} |
|} |
||
+ | <references/> |
||
+ | |||
+ | = Description = |
||
+ | == Track type (05) == |
||
− | =Comments= |
||
+ | Set track type of vehicle: 0 = rail, 1 = monorail, 2 = maglev. For setting the appropriate traction type, see [[Action0Trains#Engine traction type 19|prop19]]. |
||
+ | {{ottdp|1.0|no}} In OpenTTD, if a [[Action0Railtypes|rail type]] translation table is loaded, this property is an index into the table instead. |
||
− | ==Track type (05)== |
||
− | Set track type of vehicle: 0 = rail, 1 = monorail, 2 = maglev. For setting the appropriate traction type, see [[Action0Trains#Engine_traction_type_19_|prop19]]. |
||
− | In OpenTTD, if a [[Action0Railtypes|rail type]] translation table is loaded, this property is an index into the table instead. |
||
− | ==Speed (09)== |
+ | == Speed (09) == |
Train speed is in units of mph*1.6, i.e. approximately km/h. |
Train speed is in units of mph*1.6, i.e. approximately km/h. |
||
− | For wagons, this value is only used if the |
+ | For wagons, this value is only used if the "wagonspeedlimit" switch is on, and it limits the speed of the train to that of the lowest wagon speed. This limit is ignored for wagons with a livery override for the current train, so that train sets always get their max speed from the engine's max speed. |
− | For wagons, a value of 0 means |
+ | For wagons, a value of 0 means "default" (which depends on cargo type and date of introduction), and FFFF means no limit. |
− | ==Power (0B)== |
+ | == Power (0B) == |
The power of the engine, in HP. |
The power of the engine, in HP. |
||
Line 113: | Line 114: | ||
A value of 0 means that the vehicle will be a wagon, otherwise it will be an engine. |
A value of 0 means that the vehicle will be a wagon, otherwise it will be an engine. |
||
− | ==Running cost base (0E) and factor (0D)== |
+ | == Running cost base (0E) and factor (0D) == |
TTD calculates all costs by multiplying a 32-bit [[BaseCosts|base amount]] with an 8-bit factor. The base amount is changed according to inflation, whereas the factor remains constant. |
TTD calculates all costs by multiplying a 32-bit [[BaseCosts|base amount]] with an 8-bit factor. The base amount is changed according to inflation, whereas the factor remains constant. |
||
Line 189: | Line 190: | ||
|} |
|} |
||
− | ==Cost factor (17)== |
+ | == Cost factor (17) == |
The cost factor is a bit-coded value which determines how expensive an engine is. There is no distinction between steam, diesel or electric engines, they all use the same cost factor. The table below gives you some values to use for finding the right price for your engines. |
The cost factor is a bit-coded value which determines how expensive an engine is. There is no distinction between steam, diesel or electric engines, they all use the same cost factor. The table below gives you some values to use for finding the right price for your engines. |
||
Line 209: | Line 210: | ||
|} |
|} |
||
− | ==Engine traction type (19)== |
+ | == Engine traction type (19) == |
This sets the traction type of a train engine, i.e. whether it is powered by steam, diesel, electric, monorail or maglev technology. It also sets the corresponding sound effect of the engine, and if property 22 is not set, the visual effect as well. |
This sets the traction type of a train engine, i.e. whether it is powered by steam, diesel, electric, monorail or maglev technology. It also sets the corresponding sound effect of the engine, and if property 22 is not set, the visual effect as well. |
||
Line 228: | Line 229: | ||
|38..41||Maglev |
|38..41||Maglev |
||
|} |
|} |
||
− | Default value is 00, i.e. steam. For setting the appropriate track type, see [[Action0Trains# |
+ | Default value is 00, i.e. steam. For setting the appropriate track type, see [[Action0Trains#Track type 05|prop05]]. |
− | In OpenTTD, if a [[Action0Railtypes|rail type]] translation table is loaded, setting this property does NOT alter the track type. |
||
+ | {{ottdp|1.1|no}} In OpenTTD, if a [[Action0Railtypes|rail type]] translation table is loaded, setting this property does NOT alter the track type. |
||
− | ==Sort vehicle list (1A)== |
||
+ | == Sort vehicle list (1A) == |
||
− | This property is an extended byte in OpenTTD since r13831! |
||
− | This is not a property as such, but an action. It forces TTDPatch to shuffle the vehicle this |
+ | This is not a property as such, but an action. It forces TTDPatch to shuffle the vehicle this "property" is being set for in front of the vehicle with the given value of the property. The order of this list is only used in the train purchase window. |
For example, setting prop. 1A for vehicle 09 to a value of 07 would lead to the following internal list: ... 05 06 09 07 08 0A 0B ... |
For example, setting prop. 1A for vehicle 09 to a value of 07 would lead to the following internal list: ... 05 06 09 07 08 0A 0B ... |
||
− | This property can not simply be overwritten, because the list is already shuffled when trying to do so. |
+ | This property can not simply be overwritten, because the list is already shuffled when trying to do so. |
+ | {{ottdp|no|2.0}} It is possible to reset the list to its original order with a special action 0 that has num-info set to 0, and only sets property 1A for trains: |
||
− | <pre>-+00 00 01 00 00 1A+-</pre> |
||
+ | <pre>00 00 01 00 00 1A</pre> |
||
Resetting the list should however only be done by sets that contain replacements for all train vehicles. |
Resetting the list should however only be done by sets that contain replacements for all train vehicles. |
||
+ | {{ottdp|0.7|no|ottdrev=r13831}} This property is an extended byte in OpenTTD since r13831! |
||
− | ==Powered train wagons (1B and 23, see also 22)== |
||
+ | |||
+ | == Powered train wagons (1B and 23, see also 22) == |
||
Normally, train wagons are unpowered in TTD, and if you set property 0B to a non-zero value, they become engines instead. Therefore, to model real-life trains where wagons have power, a different mechanism is needed. |
Normally, train wagons are unpowered in TTD, and if you set property 0B to a non-zero value, they become engines instead. Therefore, to model real-life trains where wagons have power, a different mechanism is needed. |
||
Line 252: | Line 255: | ||
In addition to adding power, these wagons are also heavier by the amount set in property 23. |
In addition to adding power, these wagons are also heavier by the amount set in property 23. |
||
− | == |
+ | == Refit cost (1C) == |
+ | |||
− | For trains, the following [[Callbacks|callbacks]] have to be enabled by setting the corresponding bit in property 1E (certain other, not as frequently used callbacks are available without setting a bit here): |
||
+ | Refit cost, using 50% of the [[BaseCosts|purchase price cost base]]. This property can be overridden by callback 15E. |
||
+ | |||
+ | {{ottdp|1.2|no|ottdrev=r23087}} If the refit cost factor is set to zero and bit 4 of the miscellaneous flags (27) is set, auto-refitting is allowed. |
||
+ | |||
+ | == Callbacks (1E, 31) == |
||
+ | For trains, the following [[callbacks]] have to be enabled by setting the corresponding bit in properties 1E and 31 (certain other, not as frequently used callbacks are available without setting a bit here): |
||
{| |- |
{| |- |
||
Line 273: | Line 282: | ||
|- |
|- |
||
|7||80||33||Sound effect callbacks |
|7||80||33||Sound effect callbacks |
||
+ | |- |
||
+ | |8||100||161||{{ottd|14|ottdrev=gf5394ed2ef}}Engine name |
||
+ | |- |
||
+ | |9||200||163||{{ottdp|15|no|ottdrev=gd2496b6ec4}}Custom refit |
||
|} |
|} |
||
− | Bit is the bit you have to set, you do this by adding all the values for all the bits. Variable 0C value is what variable 0C will be set to, for checking it in the |
+ | Bit is the bit you have to set, you do this by adding all the values for all the bits. Variable 0C value is what variable 0C will be set to, for checking it in the VarAction2 for callbacks. |
− | + | These callbacks do not need a bit to activate them, they are always active and will be used if defined in the action 3/action 2 chain. |
|
+ | {| |- |
||
+ | !Variable 0C value!!Callback |
||
+ | |- |
||
+ | |1D||Can wagon be attached |
||
+ | |- |
||
+ | |23||Additional text in purchase screen |
||
+ | |- |
||
+ | |31||Start/stop check |
||
+ | |- |
||
+ | |32||32-day callback |
||
+ | |- |
||
+ | |36||Change Vehicle Properties |
||
+ | |- |
||
+ | |15E||Refit cost |
||
+ | |} |
||
− | ==Coefficient of tractive effort (1F)== |
+ | == Coefficient of tractive effort (1F) == |
This cofficient sets what fraction of the vehicle weight is equal to the maximum tractive effort. This includes the effect of having some unpowered axles, as well as the coefficient of friction that is available. |
This cofficient sets what fraction of the vehicle weight is equal to the maximum tractive effort. This includes the effect of having some unpowered axles, as well as the coefficient of friction that is available. |
||
− | Theoretically, this value should be calculated by taking the ratio of adhesive weight W |
+ | Theoretically, this value should be calculated by taking the ratio of adhesive weight W<sub>adh</sub> (i.e. the vehicle weight that rests on powered axles) times the coefficient of friction µ between the wheels and the rails to the total vehicle weight W, times 255, and convert to hex: |
− | prop. 1F = HEX (( |
+ | prop. 1F = HEX ((W<sub>adh</sub> * µ / W) * 255) |
− | With prop. 1F having a value of FF, the tractive effort is equal to the vehicle weight, for 80, it is half, and so on. If not set, a default of 4C is used, for a fraction of 0.30, corresponding to Wadh=W and a coefficient of friction of 0.30, which is the value used by the patch before 2.0.1 alpha 19. |
+ | With prop. 1F having a value of FF, the tractive effort is equal to the vehicle weight, for 80, it is half, and so on. If not set, a default of 4C is used, for a fraction of 0.30, corresponding to Wadh=W and a coefficient of friction of 0.30, which is the value used by the patch before TTDPatch 2.0.1 alpha 19. |
− | Sometimes you know the real-life tractive effort instead of adhesive weight and coefficient of friction. To help calculating prop. 1F in that case, here's a small example using the NS 1600 (Electric) with a mass of 84 tons and real-life tractive effort ( |
+ | Sometimes you know the real-life tractive effort instead of adhesive weight and coefficient of friction. To help calculating prop. 1F in that case, here's a small example using the NS 1600 (Electric) with a mass of 84 tons and real-life tractive effort (TE<sub>real</sub>) of 259 kN. To quickly find the value for property 1F you fill in the following formula: |
− | prop. 1F = HEX (( |
+ | prop. 1F = HEX ((TE<sub>real</sub> / (Mass * g) * 255) |
That may look confusing but you already know all variables: |
That may look confusing but you already know all variables: |
||
prop. 1F = HEX ((259 / (84 * 9.8) * 255) |
prop. 1F = HEX ((259 / (84 * 9.8) * 255) |
||
+ | |||
prop. 1F = HEX (0.3146 *255) = HEX(80.229) |
prop. 1F = HEX (0.3146 *255) = HEX(80.229) |
||
Line 304: | Line 333: | ||
Property 1F for the NS 1600 (Electric) would then be: 1F 50. |
Property 1F for the NS 1600 (Electric) would then be: 1F 50. |
||
− | ==Coefficient of air drag (20)== |
+ | == Coefficient of air drag (20) == |
This property sets the air drag coefficient c2 used for the realistic acceleration model, from 01 (no airdrag) to FF (most air drag) in arbitrary units. 00 means to use the default value that depends on the top speed (to simulate the fact that high-speed engines are more streamlined). |
This property sets the air drag coefficient c2 used for the realistic acceleration model, from 01 (no airdrag) to FF (most air drag) in arbitrary units. 00 means to use the default value that depends on the top speed (to simulate the fact that high-speed engines are more streamlined). |
||
Line 321: | Line 350: | ||
Air drag in Newtons will then be c2*v*v with v in m/s, although it is probably futile to attempt to make c2 a realistic number due to the lack of TTD's consistent scaling. If a train doesn't reach its historical top speed, you might try setting the value of prop. 20 one or two steps lower than the default above, otherwise it's probably a good idea to leave it at the default. |
Air drag in Newtons will then be c2*v*v with v in m/s, although it is probably futile to attempt to make c2 a realistic number due to the lack of TTD's consistent scaling. If a train doesn't reach its historical top speed, you might try setting the value of prop. 20 one or two steps lower than the default above, otherwise it's probably a good idea to leave it at the default. |
||
− | ==Shorter train vehicles (21)== |
+ | == Shorter train vehicles (21) == |
− | |||
− | This property reduces the length of train vehicles, in units of 1/8th (12.5%). The value 00 means the vehicle has the full length, 01 means shorter by 1/8th (12.5%), up to 05=shorter by 5/8ths (62.5%). Larger numbers will not work properly (**), except at the end of the train*. The vehicle length is set whenever it leaves a depot. This property does not work for the first vehicle in a train (i.e. the engine). |
||
− | |||
− | * This means that it is only safe to use values larger than 05 in the length callback making sure that they are only returned for the very last vehicle in the train. Otherwise the train will occasionally fall apart, with the wagons after the shortest one stopping to move. |
||
+ | This property reduces the length of train vehicles, in units of 1/8th (12.5%). The value 00 means the vehicle has the full length, 01 means shorter by 1/8th (12.5%), up to 05=shorter by 5/8ths (62.5%). Larger numbers will not work properly |
||
− | ** This restriction has been removed in OpenTTD r15793. Every vehicle can have a length between 1/8 and 8/8 independent of its position in the chain. |
||
+ | <ref>{{ottdp|1.0|no|ottdrev=r15793}} This restriction has been removed in OpenTTD r15793. Every vehicle can have a length between 1/8 and 8/8 independent of its position in the chain.</ref>, |
||
+ | except at the end of the train |
||
+ | <ref>{{ottdp|<1.0|}} This means that it is only safe to use values larger than 05 in the length callback making sure that they are only returned for the very last vehicle in the train. Otherwise the train will occasionally fall apart, with the wagons after the shortest one stopping to move.</ref>. The vehicle length is set whenever it leaves a depot. This property does not work for the first vehicle in a train (i.e. the engine). |
||
+ | <references/> |
||
− | ==Visual effects and wagon power (22)== |
+ | == Visual effects and wagon power (22) == |
− | By default, the visual effect of train engines is determined by the traction type (property 19). With this option you can change the type of effect as well as the position of it relative to the vehicle. (Note: for TTDPatch and OpenTTD up to r21229 only the positioning of steam actually works. For |
+ | By default, the visual effect of train engines is determined by the traction type (property 19). With this option you can change the type of effect as well as the position of it relative to the vehicle. (Note: for TTDPatch and OpenTTD up to r21229 only the positioning of steam actually works. For {{ottdp|1.1|no|ottdrev=r21230}} positioning diesel smoke and electric sparks works as well) The position of the effect provides a range from 0 to F that is added to the type of the effect. |
Position 0 corresponds to a point half a vehicle length ahead of the vehicle, 4 is the front of the vehicle, 8 the middle, C the end and F is a half length behind the vehicle. Intermediate values are in-between. |
Position 0 corresponds to a point half a vehicle length ahead of the vehicle, 4 is the front of the vehicle, 8 the middle, C the end and F is a half length behind the vehicle. Intermediate values are in-between. |
||
− | Additionally, this property can be used to disable powered wagons of this type, although that is usually done with callback 10 instead (which has the same meaning as prop. 22, but is more flexible). |
+ | Additionally, this property can be used to disable powered wagons of this type, although that is usually done with [[Callbacks#Visual_effect_and_wagon_power_.2810.29| callback 10]] instead (which has the same meaning as prop. 22, but is more flexible). |
{| |- |
{| |- |
||
Line 343: | Line 372: | ||
|00..0F||Use the default effect type, but reposition it. For engines this is defined via property 19, wagons have no default effect. |
|00..0F||Use the default effect type, but reposition it. For engines this is defined via property 19, wagons have no default effect. |
||
|- |
|- |
||
− | |10..1F|| |
+ | |10..1F||Steam puffs |
|- |
|- |
||
− | |20..2F|| |
+ | |20..2F||Diesel fumes |
|- |
|- |
||
− | |30..3F|| |
+ | |30..3F||Electric sparks |
|- |
|- |
||
− | |40|| |
+ | |40||Disable visual effect |
|- |
|- |
||
+ | |41..7F||{{ottdp|1.5|no|ottdrev=r26747}} Create effects with [[Callbacks#Advanced_effect_creation_.28160.29|Callback 160]] using one of these spawning models: |
||
− | |80+10..80+3F|| Same as above, but disable wagon power |
||
+ | * 41 Steam: Gradually less effects when approaching max speed |
||
+ | * 42 Diesel: Effect proportional to acceleration, no effect when idling at top speed |
||
+ | * 43 Electric: Random effect, gradually less likely when approaching max spped |
||
+ | * 44-7F Reserved |
||
|- |
|- |
||
− | |80+ |
+ | |80+00..80+7F||Same as 00..7F above, but disable wagon power |
|} |
|} |
||
Line 359: | Line 392: | ||
For example, 28 would make the wagon powered and emit diesel fumes, but 80+28 = A8 would only emit the diesel fumes without adding power. |
For example, 28 would make the wagon powered and emit diesel fumes, but 80+28 = A8 would only emit the diesel fumes without adding power. |
||
− | ==Miscellaneous flags (27)== |
+ | == Miscellaneous flags (27) == |
This is a bit mask, with the following bits: |
This is a bit mask, with the following bits: |
||
{| |- |
{| |- |
||
− | !Bit!! Value!! Meaning |
+ | !Bit!! Value!! Version !!Meaning |
|- |
|- |
||
+ | |0|| 1||{{ottdp|0.6|2.5}}|| Vehicle tilts in curves, and thus gets speed bonus <ref>The tilting speed bonus only applies if all vehicles in the train have this bit set. In TTDPatch it requires the "curves" switch to be on. For realistic curves, it gives the train two free curving pieces with no speed decrease, and for other settings, it increases the curves setting by one (0->1, 1->2, 2->2). In OpenTTD, the curve speed limit increases by 20% if 'realistic' acceleration is enabled, else there is no effect. |
||
− | |0|| 1|| Vehicle tilts in curves, and thus gets speed bonus |
||
+ | </ref> |
||
|- |
|- |
||
− | |1|| 2|| Uses two company colors |
+ | |1|| 2||{{ottdp|0.6|2.5}}|| Uses two company colors |
|- |
|- |
||
− | |2|| 4|| Vehicle is a multiple unit (DMU/EMU), for colour selection |
+ | |2|| 4||{{ottdp|0.6|2.5}}|| Vehicle is a multiple unit (DMU/EMU), for colour selection |
|- |
|- |
||
− | |3|| 8|| |
+ | |3|| 8||Varies|| {{ottdp|1.1|no|ottdrev=r21966}}Vehicle can be flipped around in the depot. <br>{{ottdp|13|no|no}}This flag is no longer required, vehicles can always be flipped. |
+ | <ref>From {{ottd|13|no}} onwards, OpenTTD will again allow all vehicles to flip, and will automatically adjust offsets accordingly. From {{ottd|13|no}}, if this flag is set, OpenTTD will not automatically apply the correct offsets for vehicles < 8/8 long, and will defer to offsets set by the grf. Do not set this flag unless you need it for a specific reason. |
||
+ | <br> |
||
+ | For {{ottd|1.1|r21966}} up to {{ottdp|12|no|no}} when you enable flipping of a vehicle in a depot you must make sure that the graphics are correctly aligned when flipped as well. Especially in the case of shortened vehicles. |
||
+ | <br> |
||
+ | Prior to {{ottd|1.1|r21966}} all non-multiheaded/non-articulated vehicles would be able to flip around in the depot. As such {{ottd|1.1|r21966}} disables a "feature" in OpenTTD, but often it makes no sense to flip vehicles around (symetric vehicles) or the graphics are wrong (most shortened vehicles), and thus only enabling this when the NewGRF developer says it is possible is better. |
||
+ | <br> |
||
+ | For all relevant OpenTTD versions, the flipping bit has no effect for multiheaded or articulated vehicles as they cannot be flipped in depot. |
||
+ | </ref> |
||
+ | |- |
||
+ | |4|| 10||{{ottdp|1.2|no|ottdrev=r23087}}|| Auto-refitting is enabled for refits where callback 15E allows it or prop 1C specifies zero cost |
||
+ | |- |
||
+ | |5|| 20||{{ottdp|1.2|no|ottdrev=r23861}}|| Use cargo multiplier for default cargo (and load amount). See page about [[VehicleRefitting#Misc._vehicle_flag_5_.27use_of_capacity_multiplier_for_default_cargo.27_set|vehicle refitting]]. |
||
+ | |- |
||
+ | |6|| 40||{{ottdp|1.3|no|ottdrev=r24124}}|| Disable breakdown smoke effect. |
||
+ | |- |
||
+ | |7|| 80||{{ottdp|1.7|no|ottdrev=r27668}}|| [[Action2/Vehicles#Composing_vehicles_from_multiple_sprites|Compose vehicle from multiple sprites.]] |
||
|} |
|} |
||
+ | <references /> |
||
− | The tilting speed bonus only applies if all vehicles in the train have this bit set. In TTDPatch it requires the "curves" switch to be on. For realistic curves, it gives the train two free curving pieces with no speed decrease, and for other settings, it increases the curves setting by one (0->1, 1->2, 2->2). In OpenTTD, the curve speed limit increases by 20% if 'realistic' acceleration is enabled, else there is no effect. |
||
+ | == Cargo classes (28, 29, 32) == |
||
− | When you enable flipping of a vehicle in a depot you must make sure that the graphics are correctly aligned when flipped as well. Especially in the case of shortened vehicles. For multiheaded or articulated vehicles the flipping bit has no effect; these vehicles are never to be flipped around in the depot. |
||
+ | To make vehicle sets more compatible with future new cargo definitions, these three properties allow vehicles to define what type of cargo they should be refittable to. A wagon will be refittable to all cargo types that match any of the classes set in prop. 28 ''and'' have all of the classes set in prop. 32, except for the ones that match any of the classes set in prop. 29. In addition, afterwards those cargo types listed in prop. 1D will be toggled. In terms of logic, it is |
||
− | In versions of OpenTTD before r21966 (~1.1.0-beta5) all non-multiheaded/non-articulated vehicles would be able to flip around in the depot. As such this disables a "feature" in OpenTTD, but often it makes no sense to flip vehicles around (symetric vehicles) or the graphics are wrong (most shortened vehicles), and thus only enabling this when the NewGRF developer says it is possible is better. |
||
− | ==Cargo classes (28, 29)== |
||
+ | Refit list = (cargos from prop. 28 filtered by prop. 32 AND NOT cargos from prop. 29) XOR cargos from prop. 1D |
||
− | To make vehicle sets more compatible with future new cargo definitions, these two properties allow vehicles to define what type of cargo they should be refittable to. A wagon will be refittable to all cargo types that match the classes set in prop. 28 except for the ones that match the classes set in prop. 29. In addition, afterwards those cargo types listed in prop. 1D will be toggled. In terms of logic, it is |
||
+ | This means, if a cargo type is in the list because it matches props 28/31 but not prop 29, having the respective bit set in prop. 1D will disable it again. Conversely, if the cargo type is not in the list, the bit in prop. 1D will add it. This way, if props. 28/29 are unset, prop. 1D will retain the original meaning, but it is still able to selectively add or remove certain cargo types even if props. 28/29 are used. |
||
− | Refit list = (cargos from prop. 28 AND NOT cargos from prop. 29) XOR cargos from prop. 1D |
||
− | |||
− | This means, if a cargo type is in the list because it matches prop. 28 but not prop 29, having the respective bit set in prop. 1D will disable it again. Conversely, if the cargo type is not in the list, the bit in prop. 1D will add it. This way, if props. 28/29 are unset, prop. 1D will retain the original meaning, but it is still able to selectively add or remove certain cargo types even if props. 28/29 are used. |
||
As a consequence, you have both full control over the cargo types that you know of (using prop. 1D), and those you don't know of yet (using props. 28/29). Leave the bits for cargos that you don't know of unset in prop. 1D, and set/clear the bits for known cargos to add/remove them from the list as appropriate. |
As a consequence, you have both full control over the cargo types that you know of (using prop. 1D), and those you don't know of yet (using props. 28/29). Leave the bits for cargos that you don't know of unset in prop. 1D, and set/clear the bits for known cargos to add/remove them from the list as appropriate. |
||
+ | |||
+ | {{ottd|1.2|r23291}} It is recommended to use properties 2C and 2D instead of property 1D, as property 1D behaves badly if the cargo classes of a cargo are ever changed. |
||
The class list is a bit mask. See the action0 cargos page for bits and classes defined so far. |
The class list is a bit mask. See the action0 cargos page for bits and classes defined so far. |
||
− | [[Action0Cargos# |
+ | Take a look at [[Action0Cargos#Cargo classes 16|Action0 for cargos]] for the classes defined so far. |
− | Note that cargo types may belong to several classes. This is the reason for making |
+ | Note that cargo types may belong to several classes. This is the reason for making three properties, an additive, a filter, and a subtractive one, because this way a vehicle can be specified to be refittable to, for example, all express cargo that does not require refrigeration (i.e., from the default cargos, no food). |
− | For the cargo types added in this way, the vehicle will probably have no specific graphics (in [[Action3|action 3]]) to show the cargo load. In this case, the default will be used, which should therefore be sufficiently generic-looking if possible. However, using [[ |
+ | For the cargo types added in this way, the vehicle will probably have no specific graphics (in [[Action3|action 3]]) to show the cargo load. In this case, the default will be used, which should therefore be sufficiently generic-looking if possible. However, using [[VariationalAction2/Vehicles#Vehicle cargo info 47|vehicle variable 47]] you can at least select the graphics most appropriate for the cargo type's class. |
− | About the interaction with other properties take a look at the summary page about |
+ | About the interaction with other properties take a look at the summary page about [[VehicleRefitting|vehicle refitting]]. |
+ | |||
+ | Disclaimer: there is no guarantee that classes won't vary over time or between sets. The classes of a cargo may change between different versions of a specific industry/cargo newgrf, or different classes may be set for the same cargo label by different industry/cargo newgrfs. Feel free to use classes in your set for conveniently refitting to cargos, but if you - the vehicle author - care about specific cargos being transported in specific vehicles, use label based refits (changing labels without a very good reason is considered to be bad practice). |
||
+ | |||
+ | == Long format introduction date (2A) == |
||
+ | |||
+ | Set the vehicle introduction date, in days since the year 0. This takes account of leap years; dividable by 4, but not 100 unless 400. A start date of 1920-01-01 is obtained with a value of 701265 (51 B3 0A 00). This property must be set after property 00 to take effect. |
||
+ | |||
+ | {{ottdp|no|}} In TTDPatch, dates after 2044 will be limited to 2044. |
||
+ | |||
+ | == Custom cargo ageing period (2B) == |
||
+ | |||
+ | This property allows to modify the period in ticks after which cargo carried by the vehicle is aged. By default, cargo is aged every 185 ticks. A value of 0 disables ageing of cargo. This property can be modified via [[Callbacks#Change_vehicle_properties_.2836.29|callback 36]]. |
||
+ | |||
+ | Changing this value from the default does not automatically make the vehicle earn more or less. Predicting the effect is complicated, as it depends on many things, including: vehicle speed, route length, route delays, transfer credits, the payment curve set by the cargo, and whether the cargo is already aged from a previous transfer when the vehicle loads it. |
||
+ | |||
+ | Authors are advised that tests show this property can lead to disappointment. Avoid, or use with caution. |
||
+ | |||
+ | == List of always refittable cargo types (2C, 2D) == |
||
+ | |||
+ | These two properties allows to unconditionally include or exclude cargo types for refittability independent of any of the other refit properties or the cargo classes. If you specify a cargo type that is not available, the cargo type will be silently ignored. |
||
+ | |||
+ | The format for both properties is: |
||
+ | |||
+ | <pre>2C/2D <nvar> (<Index into cargo type table>){n}</pre> |
||
+ | |||
+ | That is you give the number of cargos in a single byte followed by a list of that length of indexes into the cargo translation table ([[CargoTypes|Type A]]). |
||
+ | |||
+ | == Maximum curve speed modifier (2E) == |
||
+ | |||
+ | This property allows to give vehicles a maximum curve speed modifier. The given value is treated as a signed word with 8 fractional bits. This property can be modified via [[Callbacks#Change_vehicle_properties_.2836.29|callback 36]]. |
||
+ | |||
+ | The modifier is applied after the normal curve speed calculation is done using the formula max_curve_speed * (1 + prop 2E). This means that the default property value of 0 is equivalent to no change. While values less than -1.0 are technically possible, the resulting vehicle curve speed is clamped at 2 mph-ish to make sure vehicles don't become permanently stuck. |
||
+ | |||
+ | If different vehicles in a train have different curve speed modifiers, the lowest value wins. |
||
+ | |||
+ | == Vehicle variant group (2F) == |
||
+ | |||
+ | This property supports grouping vehicles in the purchase menu (also the autoreplace menu). The property value is the ID of another vehicle in the same GRF which will act as the parent for vehicles in the group. |
||
+ | |||
+ | Groups can also be nested (this is experimental as of December 2022 and may change with testing). |
||
+ | |||
+ | See also [[Action0Trains#Extra flags (30)|vehicle extra flags]] which can influence the behaviour of vehicles in variant groups. |
||
+ | |||
+ | See also https://github.com/OpenTTD/OpenTTD/pull/10220 |
||
+ | |||
+ | == Extra flags (30) == |
||
+ | |||
+ | This is a bit mask, with the following bits: |
||
+ | |||
+ | {| |- |
||
+ | !Bit!! Value!! Version !!Meaning |
||
+ | |- |
||
+ | |0|| 1||{{ottdp|13|no}}|| Disable "New Vehicle" news message for this engine |
||
+ | |- |
||
+ | |1|| 2||{{ottdp|13|no}}|| Disable "Exclusive Preview" for this engine |
||
+ | |- |
||
+ | |2|| 4||{{ottdp|13|no}}|| Variants - Include this variant when primary engine has "Exclusive Preview" |
||
+ | |- |
||
+ | |3|| 8||{{ottdp|13|no}}|| Variants - (Attempt to) Synchronize reliability the primary engine |
||
+ | |- |
||
+ | |} |
||
− | == |
+ | == Extra callback flags (31) == |
+ | See [[#Callbacks_.281E.2C_31.29]] |
||
− | Set the vehicle introduction date, in days since the year 0. This takes account of leap years; dividable by 4, but not 100 unless 400. A start date of 1920-01-01 is obtained with a value of 701265 (51 B3 0A 00). This property must be set after property 00 to take effect. In TTDPatch, dates after 2044 will be limited to 2044. |
||
− | =Example= |
+ | = Example = |
Below is an example of what a real Action 0 pseudo-sprite could look like for a train engine. |
Below is an example of what a real Action 0 pseudo-sprite could look like for a train engine. |
||
Line 441: | Line 551: | ||
|FD||<value>: FD for new graphics |
|FD||<value>: FD for new graphics |
||
|} |
|} |
||
− | Since nfo version 7, so-called [[GRFActionsDetailed# |
+ | Since nfo version 7, so-called [[GRFActionsDetailed#Byte order|"escape sequences"]] have been introduced in an attempt to offer a more human-readable form. |
Below is the same example as above, with escape sequences being used: |
Below is the same example as above, with escape sequences being used: |
Latest revision as of 21:45, 18 November 2024
Introduction
Defining properties of train vehicles.
Properties
Number | Size | Version | Description | Available for articulated parts |
---|---|---|---|---|
05 | B | 0.6 2.0 | Track type (see below) | should be same as front |
08 | B | 0.6 2.0 | AI special flag: set to 1 if engine is 'optimized' for passenger service (AI won't use it for other cargo), 0 otherwise | no |
09 | W | 0.6 2.0 | Speed in mph*1.6 (see below) | no |
0B | W | 0.6 2.0 | Power (0 for wagons) | should be zero |
0D | B | 0.6 2.0 | Running cost factor (0 for wagons) | should be zero |
0E | D | 0.6 2.0 | Running cost base, see below | should be zero |
12 | B | 0.6 2.0 | Sprite ID (FD for new graphics) | yes |
13 | B | 0.6 2.0 | Dual-headed flag; 1 if dual-headed engine, 0 otherwise | should be zero also for front |
14 | B | 0.6 2.0 | Cargo capacity | yes |
15 | B | 0.6 2.0 | Cargo type, see CargoTypes GRFv≤7 For GRF version 7 and below: Type B 'cargo slot' |
yes |
16 | B | 0.6 2.0 | Weight in tons | should be zero |
17 | B | 0.6 2.0 | Cost factor | should be zero |
18 | B | <0.7 2.0[1] | Engine rank for the AI (AI selects the highest-rank engine of those it can buy) | no |
19 | B | 0.6 2.0 GRFv≥1 | Engine traction type (see below) | no |
1A | B/B*[2] | 0.6 2.0 GRFv≥1 | Not a property, but an action: sort the purchase list. | no |
1B | W | 0.6 2.5 GRFv≥6 | Power added by each wagon connected to this engine, see below | should be zero |
1C | B | 0.6 2.5 GRFv≥6 | Refit cost, using 50% of the purchase price cost base | yes |
1D | D | 0.6 2.5 GRFv≥6 | Bit mask of cargo types available for refitting, see column 2 (bit value) in CargoTypes. Obsoleted by properties 2C/2D | yes |
1E | B | 0.6 2.5 GRFv≥6 | Callback flags bit mask, see below | yes |
1F | B | 0.6 2.5 | Coefficient of tractive effort | should be zero |
20 | B | 1.1 2.5 | Coefficient of air drag | should be zero |
21 | B | 0.6 2.0 GRFv≥2 | Make vehicle shorter by this amount, see below | yes |
22 | B | 0.6 2.5 GRFv≥6 | Set visual effect type (steam/smoke/sparks) as well as position, see below | yes |
23 | B | 0.6 2.5 GRFv≥6 | Set how much weight is added by making wagons powered (i.e. weight of engine), see below | should be zero |
24 | B | 0.6 2.5 | High byte of vehicle weight, weight will be prop.24*256+prop.16 | should be zero |
25 | B | 0.6 2.5 | User-defined bit mask to set when checking veh. var. 42 | yes |
26 | B | 0.6 2.5 | Retire vehicle early, this many years before the end of phase 2 (see Action0General) | no |
27 | B | 0.6 2.5 | Miscellaneous flags | partly |
28 | W | 0.6 2.5 | Refittable cargo classes | yes |
29 | W | 0.6 2.5 | Non-refittable cargo classes | yes |
2A | D | 0.6 2.5 | Long format introduction date | no |
2B | W | 1.2 | Custom cargo ageing period | yes |
2C | B n*B | 1.2 | List of always refittable cargo types | yes |
2D | B n*B | 1.2 | List of never refittable cargo types | yes |
2E | W | 12 | Maximum curve speed modifier | yes |
2F | W | 13 | Vehicle variant group | no |
30 | D | 13 | Extra flags | ?? |
31 | B | 14 | Additional callback flags bit mask, see below | yes |
32 | W | 15 | Cargo classes required for refittability | yes |
Description
Track type (05)
Set track type of vehicle: 0 = rail, 1 = monorail, 2 = maglev. For setting the appropriate traction type, see prop19.
1.0 In OpenTTD, if a rail type translation table is loaded, this property is an index into the table instead.
Speed (09)
Train speed is in units of mph*1.6, i.e. approximately km/h.
For wagons, this value is only used if the "wagonspeedlimit" switch is on, and it limits the speed of the train to that of the lowest wagon speed. This limit is ignored for wagons with a livery override for the current train, so that train sets always get their max speed from the engine's max speed.
For wagons, a value of 0 means "default" (which depends on cargo type and date of introduction), and FFFF means no limit.
Power (0B)
The power of the engine, in HP.
A value of 0 means that the vehicle will be a wagon, otherwise it will be an engine.
Running cost base (0E) and factor (0D)
TTD calculates all costs by multiplying a 32-bit base amount with an 8-bit factor. The base amount is changed according to inflation, whereas the factor remains constant.
For the running costs of train vehicles, the following base amounts are available depending on the vehicle type (the value here is a pointer into TTD's memory where the actual amount is stored):
Type | Value | in little-endian notation |
---|---|---|
Steam engines | 4C30 | 30 4C 00 00 |
Diesel engines | 4C36 | 36 4C 00 00 |
Electric engines | 4C3C | 3C 4C 00 00 |
Wagons | 0 | 00 00 00 00 |
Theoretically, you could use pointers to other base amounts available in TTD, but these are the numbers TTD uses for train vehicles.
The following are some real values for maintenance costs depending on the setting of the above two factors. This value is correct for medium difficulty, but increases and decreases for hard and easy difficulties respectively. These are the costs of a new game starting in 1921, because they obviously increase with inflation over time (unless noinflation is turned on).
Running cost base 4C30 (steam)
Running cost factor | Maintenance cost |
---|---|
01 | $ 42 |
10 | $ 700 |
20 | $ 1.400 |
80 | $ 5.600 |
A0 | $ 7.000 |
FF | $ 11.112 |
Running cost base 4C36 (diesel)
Running cost factor | Maintenance cost |
---|---|
01 | $ 40 |
10 | $ 650 |
20 | $ 1.300 |
80 | $ 5.200 |
A0 | $ 6.500 |
FF | $ 10.318 |
Running cost base 4C3C (electric)
Running cost factor | Maintenance cost |
---|---|
01 | $ 36 |
10 | $ 600 |
20 | $ 1.200 |
80 | $ 4.800 |
A0 | $ 6.000 |
FF | $ 9.524 |
Cost factor (17)
The cost factor is a bit-coded value which determines how expensive an engine is. There is no distinction between steam, diesel or electric engines, they all use the same cost factor. The table below gives you some values to use for finding the right price for your engines.
Cost factor | Price |
---|---|
01 | $ 3.124 |
10 | $ 50.000 |
20 | $ 100.000 |
80 | $ 400.000 |
A0 | $ 500.000 |
FF | $ 796.874 |
Engine traction type (19)
This sets the traction type of a train engine, i.e. whether it is powered by steam, diesel, electric, monorail or maglev technology. It also sets the corresponding sound effect of the engine, and if property 22 is not set, the visual effect as well.
The following ranges are available (and it does not matter which value you pick):
Values | Traction type |
---|---|
00..07 | Steam |
08..27 | Diesel |
28..31 | Electric |
32..37 | Monorail |
38..41 | Maglev |
Default value is 00, i.e. steam. For setting the appropriate track type, see prop05.
1.1 In OpenTTD, if a rail type translation table is loaded, setting this property does NOT alter the track type.
Sort vehicle list (1A)
This is not a property as such, but an action. It forces TTDPatch to shuffle the vehicle this "property" is being set for in front of the vehicle with the given value of the property. The order of this list is only used in the train purchase window.
For example, setting prop. 1A for vehicle 09 to a value of 07 would lead to the following internal list: ... 05 06 09 07 08 0A 0B ...
This property can not simply be overwritten, because the list is already shuffled when trying to do so.
2.0 It is possible to reset the list to its original order with a special action 0 that has num-info set to 0, and only sets property 1A for trains:
00 00 01 00 00 1A
Resetting the list should however only be done by sets that contain replacements for all train vehicles.
0.7 This property is an extended byte in OpenTTD since r13831!
Powered train wagons (1B and 23, see also 22)
Normally, train wagons are unpowered in TTD, and if you set property 0B to a non-zero value, they become engines instead. Therefore, to model real-life trains where wagons have power, a different mechanism is needed. To make train wagons powered, you set property 1B of the engine instead of the wagon. This determines how much power each wagon adds to the train when attached to this engine. This only applies to wagons with a graphics override for this engine as well. This means that for example passenger wagons (with an override) will add power, but coal wagons (with no override) will not.
In addition to adding power, these wagons are also heavier by the amount set in property 23.
Refit cost (1C)
Refit cost, using 50% of the purchase price cost base. This property can be overridden by callback 15E.
1.2 If the refit cost factor is set to zero and bit 4 of the miscellaneous flags (27) is set, auto-refitting is allowed.
Callbacks (1E, 31)
For trains, the following callbacks have to be enabled by setting the corresponding bit in properties 1E and 31 (certain other, not as frequently used callbacks are available without setting a bit here):
Bit is the bit you have to set, you do this by adding all the values for all the bits. Variable 0C value is what variable 0C will be set to, for checking it in the VarAction2 for callbacks.
These callbacks do not need a bit to activate them, they are always active and will be used if defined in the action 3/action 2 chain.
Variable 0C value | Callback |
---|---|
1D | Can wagon be attached |
23 | Additional text in purchase screen |
31 | Start/stop check |
32 | 32-day callback |
36 | Change Vehicle Properties |
15E | Refit cost |
Coefficient of tractive effort (1F)
This cofficient sets what fraction of the vehicle weight is equal to the maximum tractive effort. This includes the effect of having some unpowered axles, as well as the coefficient of friction that is available.
Theoretically, this value should be calculated by taking the ratio of adhesive weight Wadh (i.e. the vehicle weight that rests on powered axles) times the coefficient of friction µ between the wheels and the rails to the total vehicle weight W, times 255, and convert to hex:
prop. 1F = HEX ((Wadh * µ / W) * 255)
With prop. 1F having a value of FF, the tractive effort is equal to the vehicle weight, for 80, it is half, and so on. If not set, a default of 4C is used, for a fraction of 0.30, corresponding to Wadh=W and a coefficient of friction of 0.30, which is the value used by the patch before TTDPatch 2.0.1 alpha 19.
Sometimes you know the real-life tractive effort instead of adhesive weight and coefficient of friction. To help calculating prop. 1F in that case, here's a small example using the NS 1600 (Electric) with a mass of 84 tons and real-life tractive effort (TEreal) of 259 kN. To quickly find the value for property 1F you fill in the following formula:
prop. 1F = HEX ((TEreal / (Mass * g) * 255)
That may look confusing but you already know all variables:
prop. 1F = HEX ((259 / (84 * 9.8) * 255)
prop. 1F = HEX (0.3146 *255) = HEX(80.229)
HEX calculations only work with figures in the natural domain: each figure has to be a positive and round figure. Therefore the value you convert to HEX isn't 80.229 but 80:
HEX 80 = 50
Property 1F for the NS 1600 (Electric) would then be: 1F 50.
Coefficient of air drag (20)
This property sets the air drag coefficient c2 used for the realistic acceleration model, from 01 (no airdrag) to FF (most air drag) in arbitrary units. 00 means to use the default value that depends on the top speed (to simulate the fact that high-speed engines are more streamlined).
The default values are the following:
top speed (mph/1.6) | <16 | 16 | 24 | 32 | 48 | 64 | 96 | 128 | 192 | 256 | ... |
---|---|---|---|---|---|---|---|---|---|---|---|
c2 | 192 | 128 | 96 | 64 | 48 | 32 | 24 | 16 | 12 | 8 |
For higher speeds, the series is continued in the same manner.
Air drag in Newtons will then be c2*v*v with v in m/s, although it is probably futile to attempt to make c2 a realistic number due to the lack of TTD's consistent scaling. If a train doesn't reach its historical top speed, you might try setting the value of prop. 20 one or two steps lower than the default above, otherwise it's probably a good idea to leave it at the default.
Shorter train vehicles (21)
This property reduces the length of train vehicles, in units of 1/8th (12.5%). The value 00 means the vehicle has the full length, 01 means shorter by 1/8th (12.5%), up to 05=shorter by 5/8ths (62.5%). Larger numbers will not work properly [1], except at the end of the train [2]. The vehicle length is set whenever it leaves a depot. This property does not work for the first vehicle in a train (i.e. the engine).
- ↑ 1.0 This restriction has been removed in OpenTTD r15793. Every vehicle can have a length between 1/8 and 8/8 independent of its position in the chain.
- ↑ <1.0 This means that it is only safe to use values larger than 05 in the length callback making sure that they are only returned for the very last vehicle in the train. Otherwise the train will occasionally fall apart, with the wagons after the shortest one stopping to move.
Visual effects and wagon power (22)
By default, the visual effect of train engines is determined by the traction type (property 19). With this option you can change the type of effect as well as the position of it relative to the vehicle. (Note: for TTDPatch and OpenTTD up to r21229 only the positioning of steam actually works. For 1.1 positioning diesel smoke and electric sparks works as well) The position of the effect provides a range from 0 to F that is added to the type of the effect.
Position 0 corresponds to a point half a vehicle length ahead of the vehicle, 4 is the front of the vehicle, 8 the middle, C the end and F is a half length behind the vehicle. Intermediate values are in-between.
Additionally, this property can be used to disable powered wagons of this type, although that is usually done with callback 10 instead (which has the same meaning as prop. 22, but is more flexible).
Range | Effect type |
---|---|
00..0F | Use the default effect type, but reposition it. For engines this is defined via property 19, wagons have no default effect. |
10..1F | Steam puffs |
20..2F | Diesel fumes |
30..3F | Electric sparks |
40 | Disable visual effect |
41..7F | 1.5 Create effects with Callback 160 using one of these spawning models:
|
80+00..80+7F | Same as 00..7F above, but disable wagon power |
For example, 28 would make the wagon powered and emit diesel fumes, but 80+28 = A8 would only emit the diesel fumes without adding power.
Miscellaneous flags (27)
This is a bit mask, with the following bits:
Bit | Value | Version | Meaning |
---|---|---|---|
0 | 1 | 0.6 2.5 | Vehicle tilts in curves, and thus gets speed bonus [1] |
1 | 2 | 0.6 2.5 | Uses two company colors |
2 | 4 | 0.6 2.5 | Vehicle is a multiple unit (DMU/EMU), for colour selection |
3 | 8 | Varies | 1.1 Vehicle can be flipped around in the depot. 13 This flag is no longer required, vehicles can always be flipped. |
4 | 10 | 1.2 | Auto-refitting is enabled for refits where callback 15E allows it or prop 1C specifies zero cost |
5 | 20 | 1.2 | Use cargo multiplier for default cargo (and load amount). See page about vehicle refitting. |
6 | 40 | 1.3 | Disable breakdown smoke effect. |
7 | 80 | 1.7 | Compose vehicle from multiple sprites. |
- ↑ The tilting speed bonus only applies if all vehicles in the train have this bit set. In TTDPatch it requires the "curves" switch to be on. For realistic curves, it gives the train two free curving pieces with no speed decrease, and for other settings, it increases the curves setting by one (0->1, 1->2, 2->2). In OpenTTD, the curve speed limit increases by 20% if 'realistic' acceleration is enabled, else there is no effect.
- ↑ From 13 onwards, OpenTTD will again allow all vehicles to flip, and will automatically adjust offsets accordingly. From 13, if this flag is set, OpenTTD will not automatically apply the correct offsets for vehicles < 8/8 long, and will defer to offsets set by the grf. Do not set this flag unless you need it for a specific reason.
For 1.1 up to 12 when you enable flipping of a vehicle in a depot you must make sure that the graphics are correctly aligned when flipped as well. Especially in the case of shortened vehicles.
Prior to 1.1 all non-multiheaded/non-articulated vehicles would be able to flip around in the depot. As such 1.1 disables a "feature" in OpenTTD, but often it makes no sense to flip vehicles around (symetric vehicles) or the graphics are wrong (most shortened vehicles), and thus only enabling this when the NewGRF developer says it is possible is better.
For all relevant OpenTTD versions, the flipping bit has no effect for multiheaded or articulated vehicles as they cannot be flipped in depot.
Cargo classes (28, 29, 32)
To make vehicle sets more compatible with future new cargo definitions, these three properties allow vehicles to define what type of cargo they should be refittable to. A wagon will be refittable to all cargo types that match any of the classes set in prop. 28 and have all of the classes set in prop. 32, except for the ones that match any of the classes set in prop. 29. In addition, afterwards those cargo types listed in prop. 1D will be toggled. In terms of logic, it is
Refit list = (cargos from prop. 28 filtered by prop. 32 AND NOT cargos from prop. 29) XOR cargos from prop. 1D
This means, if a cargo type is in the list because it matches props 28/31 but not prop 29, having the respective bit set in prop. 1D will disable it again. Conversely, if the cargo type is not in the list, the bit in prop. 1D will add it. This way, if props. 28/29 are unset, prop. 1D will retain the original meaning, but it is still able to selectively add or remove certain cargo types even if props. 28/29 are used.
As a consequence, you have both full control over the cargo types that you know of (using prop. 1D), and those you don't know of yet (using props. 28/29). Leave the bits for cargos that you don't know of unset in prop. 1D, and set/clear the bits for known cargos to add/remove them from the list as appropriate.
1.2 It is recommended to use properties 2C and 2D instead of property 1D, as property 1D behaves badly if the cargo classes of a cargo are ever changed.
The class list is a bit mask. See the action0 cargos page for bits and classes defined so far.
Take a look at Action0 for cargos for the classes defined so far.
Note that cargo types may belong to several classes. This is the reason for making three properties, an additive, a filter, and a subtractive one, because this way a vehicle can be specified to be refittable to, for example, all express cargo that does not require refrigeration (i.e., from the default cargos, no food). For the cargo types added in this way, the vehicle will probably have no specific graphics (in action 3) to show the cargo load. In this case, the default will be used, which should therefore be sufficiently generic-looking if possible. However, using vehicle variable 47 you can at least select the graphics most appropriate for the cargo type's class. About the interaction with other properties take a look at the summary page about vehicle refitting.
Disclaimer: there is no guarantee that classes won't vary over time or between sets. The classes of a cargo may change between different versions of a specific industry/cargo newgrf, or different classes may be set for the same cargo label by different industry/cargo newgrfs. Feel free to use classes in your set for conveniently refitting to cargos, but if you - the vehicle author - care about specific cargos being transported in specific vehicles, use label based refits (changing labels without a very good reason is considered to be bad practice).
Long format introduction date (2A)
Set the vehicle introduction date, in days since the year 0. This takes account of leap years; dividable by 4, but not 100 unless 400. A start date of 1920-01-01 is obtained with a value of 701265 (51 B3 0A 00). This property must be set after property 00 to take effect.
In TTDPatch, dates after 2044 will be limited to 2044.
Custom cargo ageing period (2B)
This property allows to modify the period in ticks after which cargo carried by the vehicle is aged. By default, cargo is aged every 185 ticks. A value of 0 disables ageing of cargo. This property can be modified via callback 36.
Changing this value from the default does not automatically make the vehicle earn more or less. Predicting the effect is complicated, as it depends on many things, including: vehicle speed, route length, route delays, transfer credits, the payment curve set by the cargo, and whether the cargo is already aged from a previous transfer when the vehicle loads it.
Authors are advised that tests show this property can lead to disappointment. Avoid, or use with caution.
List of always refittable cargo types (2C, 2D)
These two properties allows to unconditionally include or exclude cargo types for refittability independent of any of the other refit properties or the cargo classes. If you specify a cargo type that is not available, the cargo type will be silently ignored.
The format for both properties is:
2C/2D <nvar> (<Index into cargo type table>){n}
That is you give the number of cargos in a single byte followed by a list of that length of indexes into the cargo translation table (Type A).
Maximum curve speed modifier (2E)
This property allows to give vehicles a maximum curve speed modifier. The given value is treated as a signed word with 8 fractional bits. This property can be modified via callback 36.
The modifier is applied after the normal curve speed calculation is done using the formula max_curve_speed * (1 + prop 2E). This means that the default property value of 0 is equivalent to no change. While values less than -1.0 are technically possible, the resulting vehicle curve speed is clamped at 2 mph-ish to make sure vehicles don't become permanently stuck.
If different vehicles in a train have different curve speed modifiers, the lowest value wins.
Vehicle variant group (2F)
This property supports grouping vehicles in the purchase menu (also the autoreplace menu). The property value is the ID of another vehicle in the same GRF which will act as the parent for vehicles in the group.
Groups can also be nested (this is experimental as of December 2022 and may change with testing).
See also vehicle extra flags which can influence the behaviour of vehicles in variant groups.
See also https://github.com/OpenTTD/OpenTTD/pull/10220
Extra flags (30)
This is a bit mask, with the following bits:
Extra callback flags (31)
Example
Below is an example of what a real Action 0 pseudo-sprite could look like for a train engine.
(A basic version)
10 * 14 00 00 03 01 02 09 C0 00 0B D8 0E 12 FD
Bytes | Meaning |
---|---|
10 | <Sprite-number> |
14 | <Length>: of the action in bytes; start counting at 0 (<action>) |
00 | <action>: sets this pseudo-sprite to function as action 0 |
00 | <Feature>: In this case Train |
03 | <Num-props>: 3 Properties to change |
01 | <Num-info>: 1 vehicle ID to make changes to |
02 | <ids...>: vehcile ID (02 - Ploddyphut Choo-Choo) |
Properties | |
09 | <Speed> |
C0 00 | <Value>: Value for Speed (192 Km/h) |
0B | <Power> |
D8 0E | <value>: value for Power (3800 HP) |
12 | <Sprite ID> |
FD | <value>: FD for new graphics |
Since nfo version 7, so-called "escape sequences" have been introduced in an attempt to offer a more human-readable form.
Below is the same example as above, with escape sequences being used:
-1 * 0 00 00 \b3 01 \b*2 // \b<number of props to change> \b*<vehicle ID> 09 \w192 // value for speed (192 Km/h) 0B \w3800 // value for power (3800 hp) 12 FD // use new graphics