Difference between revisions of "NML:Replace TTD sprites"
(Mark image-file as optional) |
Supercheese (talk | contribs) m (Clarify meaning by better comma placement) |
||
(2 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
{{NMLNavBlocksyntax}} |
{{NMLNavBlocksyntax}} |
||
− | Using a <code style="color:darkgreen">replace</code> block, it is possible to replace TTD's built-in sprites or for base grfs to define sprites via the <code style="color:darkgreen">base_graphics</code> block. The syntax is as follows: |
+ | Using a <code style="color:darkgreen">replace</code> block, it is possible to replace TTD's built-in sprites or for base grfs to define sprites via the <code style="color:darkgreen">base_graphics</code> block. Unlike many other features, this is the only way to change the terrain (see [[NML:List_of_tiles|the tile list]] for a list of terrain sprites). The syntax is as follows: |
replace [<block_name>](<sprite-id>[, <image-file>]) { |
replace [<block_name>](<sprite-id>[, <image-file>]) { |
||
Line 13: | Line 13: | ||
} |
} |
||
− | respectively |
+ | respectively. |
+ | <b>Note</b>: this only applies for the sprites in the five base grfs (thus up to sprite #4984 when looking at sprite numbers in OpenTTD), but not to the sprites defined in a base set's extra grf - they require the <code style="color:darkgreen">[[NML:Replace new sprites|replacenew]]</code> command. |
||
⚫ | |||
+ | |||
⚫ | |||
The first parameter <code style="color:darkgreen"><sprite-id></code> indicates the sprite number of the first sprite to replace. Sprite numbers are equal to the sprite numbers in the base graphics file. The [http://mz.openttdcoop.org/opengfx/authors/script.php?feature=spritesbyfile&q= OpenGFX author overview] can be used as a reference to look up these sprite numbers. |
The first parameter <code style="color:darkgreen"><sprite-id></code> indicates the sprite number of the first sprite to replace. Sprite numbers are equal to the sprite numbers in the base graphics file. The [http://mz.openttdcoop.org/opengfx/authors/script.php?feature=spritesbyfile&q= OpenGFX author overview] can be used as a reference to look up these sprite numbers. |
Latest revision as of 06:35, 28 February 2013
Vehicles, Stations, Canals, Bridges, Towns, Houses, Industries (Tiles), Cargos, Airports+Tiles, Objects, Railtypes, Roadtypes, Tramtypes, Terrain
Using a replace
block, it is possible to replace TTD's built-in sprites or for base grfs to define sprites via the base_graphics
block. Unlike many other features, this is the only way to change the terrain (see the tile list for a list of terrain sprites). The syntax is as follows:
replace [<block_name>](<sprite-id>[, <image-file>]) { list of realsprites }
and
base_graphics [<block_name>](<sprite-id>[, <image-file>]) { list of realsprites }
respectively.
Note: this only applies for the sprites in the five base grfs (thus up to sprite #4984 when looking at sprite numbers in OpenTTD), but not to the sprites defined in a base set's extra grf - they require the replacenew
command.
A <block_name>
is optional, but required if you want to define alternative sprites for the sprite block so that it can be referenced there.
The first parameter <sprite-id>
indicates the sprite number of the first sprite to replace. Sprite numbers are equal to the sprite numbers in the base graphics file. The OpenGFX author overview can be used as a reference to look up these sprite numbers.
The second parameter <image-file>
(optional) specifies the default image file to use for the new sprites.
A series of real (or recolour) sprites has to be specified between the curly braces ({
and }
). The first sprite in this list replaces the sprite with id sprite-id
, the second replaces sprite-id + 1
and so on. Sprite templates can be used as well. For example:
// Rail overlays for crossings replace rail_overlays(1005, "src/gfx/rails_overlays.png") { [ 20,198, 40,21, -20, 5] [ 71,198, 40,21, -20, 5] [117,198, 40, 7, -20, 5] [165,198, 40, 7, -20, 21] [216,198, 12,19, 10, 5] [248,198, 12,19, -24, 11] }