# Bos Wars Scripting API: Map Presentation

Stratagus FAQ PREV NEXT LUA Index

PresentMap DefinePlayerTypes SetMapMiniImage DefineMapSetup GetMapOption DefineMapOption

## Intro - Introduction to functions to present maps

A map is defined in 2 steps:

- First the presentation step which tells what the map will be alike. The presentation step is used before starting a game and allows the player to select the map he wants.

- The setup step builds the map when starting a game. At that stage the needed tilesets and the whole map are loaded into the engine.

This page documents map presentation functions.

### PresentMap(description, numplayers, mapwidth, mapheight, mapuid)

description
  A textual description of the map that can be displayed to the user.
numplayers
  The maximum number of players for this map.
mapwidth and mapheight
  The sizes of the map.
mapuid
  Random number to distinguish maps with the same file name. Be sure to change this number when changing the map.

#### Example

        PresentMap("Doom World", 4, 64, 64)

### SetMapMiniImage(mapimage)

Set a small image of the map to display when the user previews the map.

mapimage
  Path to the file with the graphic.

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

#### Example

        SetMiniImage("doomworld/doomworld.png")

### DefinePlayerType(player1, player2, ...)

Define the number of players and their type on the map. Possible values for player type are:

- "neutral"
- "nobody"
- "computer"
- "person"
- "rescue-passive"
- "rescue-active"

#### Example

        DefinePlayerTypes("person", "person")

### DefineMapSetup(luafile)

Define the map setup file that will be loaded if the player starts a game with this map.

#### Example

        DefineMapSetup("doomworld/doomworld.map")

### GetMapOption(name)

Returns the value of the option.

A map can define configuration options. A player can modify those options just before starting a game. For example: the tileset to use, your race, game type, number of opponents or the amount of resources on the map.

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

#### Example

        tileset = GetMapOption("tileset")

### DefineMapOption(name, {possible-values})

name
  Name of the option.
possible-values
  List of values the player can select. The first value is the default value.

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

#### Example

       DefineMapOption("Resources", {"Map default", "Low", "Medium", "High"})
       DefineMapOption("Difficulty", {"finger in the nose", "easy", "mission impossible"})
       DefineMapOption("TileSet", {"desert", "winter", "forest"})

Last changed: $Id: mappresentation.html 8569 2007-02-10 23:21:43Z feb $
All trademarks and copyrights on this page are owned by their respective owners.