File: mapsetup.html

package info (click to toggle)
boswars 2.8-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 96,652 kB
  • sloc: cpp: 57,250; python: 1,715; sh: 25; makefile: 17
file content (166 lines) | stat: -rw-r--r-- 4,423 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head>
<!--
----	(c) Copyright 2002-2007 by Francois Beerten

----    This program is free software; you can redistribute it and/or modify
----    it under the terms of the GNU General Public License as published by
----    the Free Software Foundation; only version 2 of the License.
----
----    This program is distributed in the hope that it will be useful,
----    but WITHOUT ANY WARRANTY; without even the implied warranty of
----    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
----    GNU General Public License for more details.
----
----    You should have received a copy of the GNU General Public License
----    along with this program; if not, write to the Free Software
----    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
----    02111-1307, USA.
-->
    <title>Bos Wars Scripting API: Map Setup</title>
    <meta http-equiv="Content-Type" content="text/html; CHARSET=iso-8859-1">
    <link rel="stylesheet" type="text/css" href="scripts.css">
</head>
<body>
    <h1>Bos Wars Scripting API: Map Setup</h1>
<hr>
<a href="../index.html">Bos Wars</a> 
<a href="../faq.html">FAQ</a> 
<a href="mappresentation.html">PREV</a> 
<a href="limits.html">NEXT</a> 
<a href="index.html">LUA Index</a> 
<hr>
<a href="#SetStartView">SetStartView</a>
<a href="#SetAiType">SetAiType</a>
<a href="#SetHeightMap">SetHeightMap</a>
<a href="#SetTile">SetTile</a>
<a href="#SetTileMap">SetTileMap</a>
<hr>
<h2>Intro - Introduction to functions to setup maps</h2>

A map is defined in 2 steps. This page documents map setup functions 
used in the second step. 
<p>
The map setup functions load the actual map into the engine.
<p>
Other functions defined elsewhere are useful in the map setup step:
<a href="game.html#CreateUnit">CreateUnit</a> and 
SetSharedVision, SetDiplomacy.
<p>

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

<h2>Functions</h2>

<a name="SetStartView"></a>
<h3>SetStartView(player, x, y)</h3>
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.
<dl>
<dt>player</dt>
<dd>number of the player</dd>
<dt>x</dt>
<dd>x position in tiles</dd>
<dt>y</dt>
<dd>y position in tiles</dd>
</dl>

<h4>Example</h4>

<pre class="lua">
SetStartView(0, 20, 10)
</pre>

<a name="SetAiType"></a>
<h3>SetAiType(player, ai-type)</h3>

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.

<p>
<dl>
<dt>player</dt>
<dd>
The player number.
</dd>
<dt>ai-type</dt>
<dd>
The name of the ai algorithm to use.
</dd></dl>

<h4>Example</h4>

<pre class="lua">
SetAiType(0, "ai-air")
</pre>

<a name="SetHeightMap"></a>
<h3>SetHeightMap(imagepath)</h3>
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.<p>
<dl>
  <dt>imagepath</dt>
  <dd>Filename of the grayscale image for the heightmap. 
   Black(0) is lowest level. White(255) is highest level.</dd>

</dl>
<p>
Note: This is for the new map format. Not implemented yet. 


<h4>Example</h4>

<pre class="lua">
SetHeightMap("doomworld/doomworldheights.png")
</pre>


<a name="SetTile"></a>
<h3>SetTile(tilemodel, x, y)</h3>

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.

<h4>Example</h4>

<pre class="lua">
-- Create a uniform desert of sand.
for i=0 to 32 do
   for j=0 to 32 do
      SetTile("sand", i, j)
   end
end
</pre>


<a name="SetTileMap"></a>
<h3>ApplyTileMap(tilemapfile, x, y, width, height)</h3>

Apply a tilemap from a compact tilemap file to our tilemap.

<dl>
  <dt>tilemapfile</dt>
  <dd>Path to the tilemapfile.</dd>
</dl>

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

<h4>Example</h4>

<pre class="lua">
-- 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)
</pre>

<p>

<hr>
All trademarks and copyrights on this page are owned by their respective owners.
<address>(c) 2002-2007 by <a href="http://boswars.org">
The Bos Wars Project</a></address></body></html>