Action0/Objects

From GRFSpecs

Jump to: navigation, search

Contents

Introduction

Defining properties of new objects.

Unlike vehicles or new stations, most new objects have no real equivalent in TTD.

The IDs are therefore free to be chosen and will in fact be allocated automatically by the patch. In action 0, you only specify IDs relative to the set, i.e. the ID of the first object type is 00, the second object type is 01 and so on. In total, each game can only have 255 object IDs for all active grf files.

The property you must set for each object ID is 08 (in addition to defining an action 3 for it). Also, all object IDs must get their classes in the right order, starting from ID 00 onwards.

Properties

NumberSizeVersionDescription
08DSupported by OpenTTD 1.1 (r20670)1.1 Supported by TTDPatch 2.6 (r2340)2.6Class label, see below
09WSupported by OpenTTD 1.1 (r20670)1.1 Supported by TTDPatch 2.6 (r2340)2.6Text ID for class
0AWSupported by OpenTTD 1.1 (r20670)1.1 Supported by TTDPatch 2.6 (r2340)2.6Text ID for this object
0BBSupported by OpenTTD 1.1 (r20670)1.1 Supported by TTDPatch 2.6 (r2340)2.6Climate availability
0CBSupported by OpenTTD 1.1 (r20670)1.1 Supported by TTDPatch 2.6 (r2340)2.6Byte representing size, see below
0DBSupported by OpenTTD 1.1 (r20670)1.1 Supported by TTDPatch 2.6 (r2340)2.6Object build cost factor (sets object removal cost factor as well)
0EDSupported by OpenTTD 1.1 (r20670)1.1 Supported by TTDPatch 2.6 (r2340)2.6Introduction date, see below
0FDSupported by OpenTTD 1.1 (r20670)1.1 Supported by TTDPatch 2.6 (r2340)2.6End of life date, see below
10WSupported by OpenTTD 1.1 (r20670)1.1 Supported by TTDPatch 2.6 (r2340)2.6Object flags, see below
11WSupported by OpenTTD 1.1 (r20670)1.1 Supported by TTDPatch 2.6 (r2340)2.6Animation information
12BSupported by OpenTTD 1.1 (r20670)1.1 Supported by TTDPatch 2.6 (r2340)2.6Animation speed
13WSupported by OpenTTD 1.1 (r20670)1.1 Supported by TTDPatch 2.6 (r2340)2.6Animation triggers
14BSupported by OpenTTD 1.1 (r20670)1.1 Supported by TTDPatch 2.6 (r2340)2.6Object removal cost factor (set after object build cost factor)
15WSupported by OpenTTD 1.1 (r20670)1.1 Supported by TTDPatch 2.6 (r2340)2.6Callback flags, see below
16BSupported by OpenTTD 1.1 (r20670)1.1 Supported by TTDPatch 2.6 (r2340)2.6Height of the building
17BSupported by OpenTTD 1.1 (r20670)1.1 Supported by TTDPatch 2.6 (r2340)2.6Number of object views

Check Lakie's Graphical Representation of the newObject Specifications

Descriptions

Object class (08)

Class labels are unique identifiers composed of the letters A-Z and/or the numbers 0-9,  analoguous to station class labels.

Their main use is to combine objects into classes and make them available by the top dropdown list in the object construction window.

Unlike for stations, there is no default class for objects. Set authors have to specify their own labels, although it is strongly recommended to follow a general scheme to try to avoid confusion.

Class IDs must be set before any other property.

Object class text ID (09)

The text ID for this class (word value). This textid should be either a TTD textid or a D4xx textid (set via D0xx in action4).

When specifying an object, you don't need to set a class name again if you already did for another one with the same class.

Object text ID (0A)

The text ID for the object for query and selection (word value). Same requirements as for property09.

Object size (0C)

The object size up to 15x15 tiles.

This byte value is divided into two nibbles. The first defines the size in y direction and the second defines the size in x (i.e., stored as YX).

Note that any value lower than 0x11 will be rejected.

Build Cost (0D)

The build cost multiplier. This is multiplied by the number of tiles for evaluation of construction and removal costs of an object.

Introduction date (0E)

Introduction date of an object, in days since the year 0. This takes account of leap years; divisible 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). In TTDPatch anything before 1920 is considered to be always available, and it should allow for objects to work past 2044, the date is also the very first date you can build the object.

End of life date (0F)

Last year an object can be build, in days since the year 0. Same requirements as above. Also note that it must be a minimum of a year (365 days) after the introduction date or TTDPatch will ignore it.

Object flags (10)

The following flags control object behaviour and are cached for built objects, so changing these flags will have no effect on already constructed objects.

BitValueVersionMeaning
01Supported by OpenTTD 1.1 (r20670)1.1 Supported by TTDPatch 2.6 (r2340)2.6Only Available in the scenario editor[1]
12Supported by OpenTTD 1.1 (r20670)1.1 Supported by TTDPatch 2.6 (r2340)2.6Irremovable[2]
24Supported by OpenTTD 1.1 (r20670)1.1 Supported by TTDPatch 2.6 (r2340)2.6Anything Can Remove (owned land behaviour)
38Supported by OpenTTD 1.1 (r20670)1.1 Supported by TTDPatch 2.6 (r2340)2.6Allow construction of the object on water
416Supported by OpenTTD 1.1 (r20670)1.1 Supported by TTDPatch 2.6 (r2340)2.6Removal cost is actually income (owned land behaviour)
532Supported by OpenTTD 1.1 (r20670)1.1 Supported by TTDPatch 2.6 (r2340)2.6Do not display foundations if on a slope
664Supported by OpenTTD 1.1 (r20670)1.1 Supported by TTDPatch 2.6 (r2340)2.6Object has animation[3]
7128Supported by OpenTTD 1.1 (r20670)1.1 Supported by TTDPatch 2.6 (r2340)2.6Only available during game play[1]
8256Supported by OpenTTD 1.1 (r20670)1.1 Supported by TTDPatch 2.6 (r2340)2.6Allows 2cc mapping for objects instead of the default 1cc
9512Supported by OpenTTD 1.11.1 Supported by TTDPatch 2.6 (r2331)2.6Disallows construction on land (also has bit 3 behaviour)
101024Supported by OpenTTD 1.11.1 Supported by TTDPatch 2.6 (r2331)2.6Draws the water under the object[4]
112048Supported by OpenTTD 1.1 (r21455)1.1 Not supported by TTDPatchAllow bridge over the object taking the building height into account
124096Supported by OpenTTD 1.1 (r21455)1.1 Supported by TTDPatch 2.6 (r2360)2.6Random bits in the "next animation frame" callback
  1. 1.0 1.1 Note that bits 0 and 7 are incompatible and setting both will make an object completely unavailable.
  2. Object cannot be removed through normal dynamite, control must be held and the removal cost will be multiplied by 25 (this is the usual behaviour for most class A objects in TTDPatch).
  3. Setting this flag will allow the object's animation counter to be increased, must be set if you plan to make use of animations. Like stations you must enable animation on a per tile basis by means of the "built tile" trigger and callback 159.
  4. Only applies when built on top of a water tile, also replaces the ground tile of the object completely. (Does not work when object built on sloped water tiles).

Animation information (11)

The low byte specifies the number of animation frames minus one, so 00 means 1 frame, 01 means 2 frames etc. The maximum number of frames is 256, although you can have some problems if your animation exceeds FD (253) frames. The high byte must be 0 for non-looping animations and 01 for looping animations. Every other value is reserved for future use. In addition, if the whole word contains FFFF, animation is turned off for this object (this is the default value).

Since you can't have properties for individual object tiles, this property applies for every tile of the object. If you don't want to animate some tiles, you should check the current position during callback 159 and return FD if the current tile doesn't need to be animated. If you also need animations of different length per tile, you'll have to use callback 158 for that.

Animation speed (12)

The meaning is the same as for house property 1B, but the lower limit is 0 instead of 2, so the fastest possible animation changes frames every game tick (27ms). The default value is 0.

Animation triggers (13)

This is a bit mask of events that should trigger callback 159, allowing to change the animation state

BitValueMeaningHappens onVar 18
01Object is builtall tiles
12Periodic tile loopsingle tile
24Synchronised periodic tile loopall tiles

Currently no trigger provides additional information in var 18.

The synchronised periodic tile loop is called directly after the (unsynchronised) periodic tile loop of the northern tile.

Object removal cost factor (14)

Cost factor for the removal of an object. This must be set after property 0D (object build cost factor) as that overwrites this value.

Callback flags (15)

For objects, the following callbacks can be defined by setting the corresponding bit in property 15:

BitValueVariable 0C valueCallback
01157Custom slope check
12158Decide next animation frame
2415ADecide animation speed
3815BDecide colour of building
41615CShow additional text in the build object window
53215DAllow/disallow autosloping

Building height (16)

Set the height of the building in heightlevels (8 pixels). For example if the structure is 16 pixels high you set this property to 2.

Supported by OpenTTD 1.1 (r21455)1.1 Not supported by TTDPatch In OpenTTD this property is used to determine the height of the build object window; the height for the object preview is set to 32 + "value of property 16" * 8. The property is also uses to determine how high a bridge must be if it is allowed by the bit in property 10.

Number of views (17)

Objects may have "views", i.e. different graphical representations, e.g. used to show rotated views of an object. Number of views may be 1, 2, or 4. Default value is 1.

For non-square objects, x and y sizes are swapped for odd views. I.e., giving an object size of 1*2 (x = 1, y = 2), it will be displayed as 1*2 for num = [0,2] (x-direction) but as 2*1 for num = [1,3] (y-direction).

Use object varaction2 var48 to access particular views of an object.

Examples

Personal tools
advertisement