Author: johns98@gmx.net

             _________ __                 __
            /   _____//  |_____________ _/  |______     ____  __ __  ______
            \_____  \\   __\_  __ \__  \\   __\__  \   / ___\|  |  \/  ___/
            /        \|  |  |  | \// __ \|  |  / __ \_/ /_/  >  |  /\___ \
           /_______  /|__|  |__|  (____  /__| (____  /\___  /|____//____  >
                   \/                  \/          \//_____/            \/
        ______________________                           ______________________
                              T H E   W A R   B E G I N S
               Stratagus - A free fantasy real time strategy game engine

# Stratagus Configuration Language Description: Tileset

Stratagus FAQ PREV NEXT LUA Index

DefineTileset DefineTileModel LoadTileModels

## Intro - Introduction to tileset functions and variables

A Tileset defines a set of tilemodels that can be used in a tiled map. The map is thus devided in tiles.

Properties of tilemodels:

- a graphic (or more if animated)
- Name
- Allowed tilemodel neighbours
- Speed (aka cost) modifiers
- Category (like 'land', 'water', 'beach', 'lava', 'walkable', ...)
- Ressources and how it can be harvested
- Destruction: how the tile can be destroyed. When destroyed the tile transforms into another tilemodel.

Note: This is the for the new map format. Not implented yet.

## Functions

### DefineTileSet(name, width, height)

Define a tileset to which tilemodels can be added. The width and height define the size of each tile.

This could also be defined in own levels.

Note: This is the for the new map format. Not implented yet.

name
  Name of the tilemodel as exposed to the user in the editor and used in the scripts.
width
  width of the tiles. Most of the times, people use 32 pixels tiles.
height
  height of the tiles. Most of the times, people use 32 pixels tiles.

#### Example

        DefineTileset("desert", 32, 32)

### DefineTileModel(...)

Define a tile model which is used in the tilemap.

Note: This is the for the new map format. Not implented yet.

name
  Name of the tilemodel as exposed to the user in the editor
tileset
  Name of the tileset this tilemodel is part of.
imagepath
  Filename of the image with graphics of tiles.
imageposition
  Position of the tile graphic in the graphic file.
categories = {category1, category2, ...}
  Bool strings defined by DefineBool that identifies the categories of this tylemodel. Examples: water, space, beach, land, grass. A tilemodel will often be part of generic categories and more specific ones. For example ground and grass. The categories allows to specify generic behaviours and special ones. Building restrictions will use the categories.
neighbours = {{N-neighbour}, {E-neighbour}, ...}
  Names of the categories of tilemodels which can be used next to this tilemodel. Each list is for a seperate direction: north, east, south, west. This is useful only for the editor.
  Note: the current tilemodel can't be it's neighbour if it's not in one of the categories listed here.
accessmodifier = {unitboolflag=modifier, unitboolflag2=modifier2, ...}
  Speed modification in percents for units with the given boolflag. Use 0 for unaccessible tiles.
harvest = {harvested= tilemodel, resource-name = quantity}
  harvested: tilemodel the tile transforms into when completely harvested.
  resource-name: Name of the resource available and in what quantity.
  Of course, harvest list isnt needed when the tile cannot be harvested.
destruction = {destroyed = tilemodel, damage = damage-value}
  destroyed: tilemodel the tile transforms into when destroyed.
  damage: damage required to destroy this tile.
  Of course destruction list isn't needed when the tile cant be destroyed.

#### Example

        DefineTileModel("oily-sand", "desert",
            "graphics/tilesets/desert.png", 12,
            categories = {"land", "buildable"},
            neighbours = {{"sand","beach-N"},{"sand","beach-E"},{"sand","beach-S"},{"sand","beach-W"}}
            accessmodier = {groundtroups=50, ships=0, camels=200},
            harvest= {harvested-tile="sand", oil=23},
            destruction = {destroyed="sand", damage=100}
        )

### LoadTileModels(luafile)

Load the configuration scripts for the tilemodels.

Note: This function is used in the map files.

luafile
  The path to the lua file to load which will define the tilemodels.

(C) Copyright 2002-2015 by The Stratagus Project under the GNU General Public License.
All trademarks and copyrights on this page are owned by their respective owners.