Bos Wars Scripting API: Map Setup
Bos Wars
FAQ
PREV
NEXT
LUA Index
SetStartView
SetAiType
SetHeightMap
SetTile
SetTileMap
Intro - Introduction to functions to setup maps
A map is defined in 2 steps. This page documents map setup functions
used in the second step.
The map setup functions load the actual map into the engine.
Other functions defined elsewhere are useful in the map setup step:
CreateUnit and
SetSharedVision, SetDiplomacy.
Note: This is for the new map format. Not implemented yet.
Functions
SetStartView(player, x, y)
Set the location of the map stratagus will show to the given
player when starting. This works a little bit like a special
CenterMap for each player.
- player
- number of the player
- x
- x position in tiles
- y
- y position in tiles
Example
SetStartView(0, 20, 10)
SetAiType(player, ai-type)
Set what kind of ai algorithm should be used. For example: an air based
ai for a map with a lot of obstacles. Call this function only when creating
a game, not during the game.
- player
-
The player number.
- ai-type
-
The name of the ai algorithm to use.
Example
SetAiType(0, "ai-air")
SetHeightMap(imagepath)
A pixel in the heightmap represents the height of one tile. This
function is optional. If the game doesn't need a height map, default
values will be used.
- imagepath
- Filename of the grayscale image for the heightmap.
Black(0) is lowest level. White(255) is highest level.
Note: This is for the new map format. Not implemented yet.
Example
SetHeightMap("doomworld/doomworldheights.png")
SetTile(tilemodel, x, y)
Set a tile of the tilemodel given by tilename at the position defined
by the x,y coordinates. SetTile can be called ingame for special effects.
Example
-- Create a uniform desert of sand.
for i=0 to 32 do
for j=0 to 32 do
SetTile("sand", i, j)
end
end
ApplyTileMap(tilemapfile, x, y, width, height)
Apply a tilemap from a compact tilemap file to our tilemap.
- tilemapfile
- Path to the tilemapfile.
Note: This is for the new map format. Not implemented yet.
Example
-- Load the full map from a file
SetTileMap("doomworld/doomworld.tmf", 0, 0, 64, 64)
-- Replace the middle square with a tilemap showing a volcano
SetTileMap("doomworld/volcano.tmf", 25, 25, 10, 10)
All trademarks and copyrights on this page are owned by their respective owners.
(c) 2002-2007 by
The Bos Wars Project