Tilesets

This page describes the basics of **tilesets**, as well as any special features about them in Essentials.

## Tilesets

Tilesets are used to create maps in RPG Maker XP. A tileset is a tall, thin picture made up of squares, or tiles. Each tile is 32x32 pixels. A tileset is exactly 8 tiles wide, and any number of tiles high (there is a limit of about 5000, but this is usually way more than enough). Tilesets are kept in the folder "Graphics/Tilesets".

RPG Maker XP can handle up to 999 different tilesets, which should be more than sufficient for even the largest of games.

Editing a tileset is as simple as editing a picture.

## Autotiles

RPG Maker XP allows you to include up to 7 autotiles in each tileset. These are added above the top of the main tileset as the top row of tiles. Each autotile is a separate picture file in the folder "Graphics/Autotiles". Autotiles can be animated.

Since this limit of 7 autotiles can be quite restrictive, Essentials allows you to use part of the main tileset as extra autotiles. It does this by designating a number of tiles at the top of the main tileset graphic as a space for extra autotiles, and then displays them in-game by using the autotile graphics instead of the tiles from the main tileset. This allows these extra autotiles to be animated, which is the only reason to use them.

In `class TilemapRenderer` is a hash called `EXTRA_AUTOTILES`. For example:

```
EXTRA_AUTOTILES = {
  1 => [["Sand shore"], ["Flowers2"]],
  2 => [[], ["Flowers2", "Waterfall", "Waterfall crest", "Waterfall bottom"]],
  6 => [["Water rock", "Sea deep"], []]
}

```

The keys (number to the left of the "`=>`") are tileset numbers, as seen in the Database. For a given tileset number, there is an array containing two arrays: the first contains the filenames of large autotiles, while the second contains the filenames of single tile autotiles. The order that these filenames are written determine the order in which they will use up tiles from the main tileset.

For the examples above, tileset 1 has 1 large autotile and 1 single tile autotile, tileset 2 has 4 single tile autotiles only, and tileset 6 has 2 large autotiles only.

The image on the right shows the layout of the large autotiles (sets of 48 tiles) and single tile autotiles at the top of the main tileset. All large autotiles are placed in the main tileset first (there can be any number of them), followed by the single tile autotiles (there can be any number of them).

Each large autotile can produce 48 separate tiles. The image on the right shows how these should be laid out in the main tileset. It is the same order seen when you double-click an autotile in RPG Maker XP to choose a particular tile to draw with.

The only use for extra autotiles is to allow the use of more animated autotiles. There is no point using this feature for non-animated autotiles, since you would just be adding all of their tiles to the tileset anyway.

### Extended autotile format

RPG Maker XP supports two autotile formats: single tile and large. Essentials also supports an extended format, as shown on the right.

Each frame of the extended format contains four additional tiles, which are the four concave corner tiles.

Since this format was added by Essentials, RPG Maker XP does not recognise it. It treats the extended format as the large format, and will draw its concave corner tiles in the map editor the way the large format draws them, and so they may not look correct there. In-game, however, those tiles will use the extended format's additional concave corner tiles and look right.

You may not need to use the extended autotile format at all, depending on the autotiles you are using.

### Autotile animation speed

An animated autotile changes its frame every 0.25 seconds. However, if the autotile's filename ends with "`[4]`" (the number could be any number), then it will change its frame every X/20 seconds, where "X" is the number in the filename.

## The Database

In RPG Maker XP, click the Database icon in the toolbar, or go to Tools>Database, or press F9. In here, select the "Tilesets" tab. Here you can edit the contents and properties of tilesets.

The properties of tiles in a tileset are:

* Passage - Whether the player or an NPC can walk over them or not (assuming no special effects apply).
* Passage (4 dir) - The sides which the player/NPC can pass through.
* Priority - How close to the foreground the tile is displayed. A higher number means it is closer to the foreground. The player will pass behind any tile that has a non-zero priority.
* Bush flag - Whether the bottom part of an event on that tile should be transparent, making it look like it is standing in tall grass, shallow water, etc.
* Counter Flag - Whether the player can "reach over" the tile to interact with an event on the other side (i.e. it indicates that the tile is part of a counter or desk).
* Terrain Tag - A number that gives the tile other properties as defined in the scripts. See below.

## Terrain tags

Terrain tags allow certain tiles to have special properties, such as being tiles on which wild Pokémon encounters can occur, or tiles that the player can slide around on.

All existing terrain tags are defined in the script section **TerrainTag**. They are as follows:

RPG Maker XP's tileset editor in the Database only supports terrain tags up to 7, so tiles that need terrain tags of 8 or higher need to be set elsewhere. The Debug mode menu has a function called "Edit Terrain Tags", which allows you to assign a tile any terrain tag you want.