Debian Codegraph @

doc/scripts/mapsetup.html

raw
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2 <html><head>
3 <!--
4 ---- (c) Copyright 2002-2007 by Francois Beerten
5
6 ---- This program is free software; you can redistribute it and/or modify
7 ---- it under the terms of the GNU General Public License as published by
8 ---- the Free Software Foundation; only version 2 of the License.
9 ----
10 ---- This program is distributed in the hope that it will be useful,
11 ---- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ---- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ---- GNU General Public License for more details.
14 ----
15 ---- You should have received a copy of the GNU General Public License
16 ---- along with this program; if not, write to the Free Software
17 ---- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
18 ---- 02111-1307, USA.
19 -->
20 <title>Bos Wars Scripting API: Map Setup</title>
21 <meta http-equiv="Content-Type" content="text/html; CHARSET=iso-8859-1">
22 <link rel="stylesheet" type="text/css" href="scripts.css">
23 </head>
24 <body>
25 <h1>Bos Wars Scripting API: Map Setup</h1>
26 <hr>
27 <a href="../index.html">Bos Wars</a>
28 <a href="../faq.html">FAQ</a>
29 <a href="mappresentation.html">PREV</a>
30 <a href="limits.html">NEXT</a>
31 <a href="index.html">LUA Index</a>
32 <hr>
33 <a href="#SetStartView">SetStartView</a>
34 <a href="#SetAiType">SetAiType</a>
35 <a href="#SetHeightMap">SetHeightMap</a>
36 <a href="#SetTile">SetTile</a>
37 <a href="#SetTileMap">SetTileMap</a>
38 <hr>
39 <h2>Intro - Introduction to functions to setup maps</h2>
40
41 A map is defined in 2 steps. This page documents map setup functions
42 used in the second step.
43 <p>
44 The map setup functions load the actual map into the engine.
45 <p>
46 Other functions defined elsewhere are useful in the map setup step:
47 <a href="game.html#CreateUnit">CreateUnit</a> and
48 SetSharedVision, SetDiplomacy.
49 <p>
50
51 Note: This is for the new map format. Not implemented yet.
52
53 <h2>Functions</h2>
54
55 <a name="SetStartView"></a>
56 <h3>SetStartView(player, x, y)</h3>
57 Set the location of the map stratagus will show to the given
58 player when starting. This works a little bit like a special
59 CenterMap for each player.
60 <dl>
61 <dt>player</dt>
62 <dd>number of the player</dd>
63 <dt>x</dt>
64 <dd>x position in tiles</dd>
65 <dt>y</dt>
66 <dd>y position in tiles</dd>
67 </dl>
68
69 <h4>Example</h4>
70
71 <pre class="lua">
72 SetStartView(0, 20, 10)
73 </pre>
74
75 <a name="SetAiType"></a>
76 <h3>SetAiType(player, ai-type)</h3>
77
78 Set what kind of ai algorithm should be used. For example: an air based
79 ai for a map with a lot of obstacles. Call this function only when creating
80 a game, not during the game.
81
82 <p>
83 <dl>
84 <dt>player</dt>
85 <dd>
86 The player number.
87 </dd>
88 <dt>ai-type</dt>
89 <dd>
90 The name of the ai algorithm to use.
91 </dd></dl>
92
93 <h4>Example</h4>
94
95 <pre class="lua">
96 SetAiType(0, "ai-air")
97 </pre>
98
99 <a name="SetHeightMap"></a>
100 <h3>SetHeightMap(imagepath)</h3>
101 A pixel in the heightmap represents the height of one tile. This
102 function is optional. If the game doesn't need a height map, default
103 values will be used.<p>
104 <dl>
105 <dt>imagepath</dt>
106 <dd>Filename of the grayscale image for the heightmap.
107 Black(0) is lowest level. White(255) is highest level.</dd>
108
109 </dl>
110 <p>
111 Note: This is for the new map format. Not implemented yet.
112
113
114 <h4>Example</h4>
115
116 <pre class="lua">
117 SetHeightMap("doomworld/doomworldheights.png")
118 </pre>
119
120
121 <a name="SetTile"></a>
122 <h3>SetTile(tilemodel, x, y)</h3>
123
124 Set a tile of the tilemodel given by tilename at the position defined
125 by the x,y coordinates. SetTile can be called ingame for special effects.
126
127 <h4>Example</h4>
128
129 <pre class="lua">
130 -- Create a uniform desert of sand.
131 for i=0 to 32 do
132 for j=0 to 32 do
133 SetTile("sand", i, j)
134 end
135 end
136 </pre>
137
138
139 <a name="SetTileMap"></a>
140 <h3>ApplyTileMap(tilemapfile, x, y, width, height)</h3>
141
142 Apply a tilemap from a compact tilemap file to our tilemap.
143
144 <dl>
145 <dt>tilemapfile</dt>
146 <dd>Path to the tilemapfile.</dd>
147 </dl>
148
149 <p>
150 Note: This is for the new map format. Not implemented yet.
151
152 <h4>Example</h4>
153
154 <pre class="lua">
155 -- Load the full map from a file
156 SetTileMap("doomworld/doomworld.tmf", 0, 0, 64, 64)
157 -- Replace the middle square with a tilemap showing a volcano
158 SetTileMap("doomworld/volcano.tmf", 25, 25, 10, 10)
159 </pre>
160
161 <p>
162
163 <hr>
164 All trademarks and copyrights on this page are owned by their respective owners.
165 <address>(c) 2002-2007 by <a href="http://boswars.org">
166 The Bos Wars Project</a></address></body></html>