IV. MapEditor
Introduction:
The mapedit tool allows you to create and edit individual maps (.map files)
in your adventure. All maps you create must be indexed by your maplist.txt
file which is included in the adventure pdb (see Adventure PDB section).
The mapeditor is a pretty sophisticated program. Originally developed for
Dragon Bane I, many features were added for supporting the Dragon Bane II
engine. The program should be very reliable and the user interface is fairly
optimized as it has been continuously improved since it was first written in
1997 as it was used to create the adventures included in Dragon Bane I and
II.
To edit an existing map, simply select it when prompted for the map name.
New maps can be created by running the mapeditor, going to the directory
that you want, and typing in the name of the map. The mapeditor will ask you
for the starting dimensions of the map (you may change this later).
A new map will be opened with generic brick walls around the border.
If the map does not fit on your current screen, you will get an error, and
you will have to make the font that the mapeditor window uses smaller. To
do this, go to the "Map Editor" item in the start menu, or find mapedit.exe
in the install directory and right click. Select "Properties" then go to the
font tab and select a smaller font.
There are two main sections to the mapeditor: features for editing the map,
and features for editing optional "programs" that may be stored for individual
special squares.
Mapeditor usage:
Understanding The Screen:
- Centered above the map, in quotes is the name of the map that will appear to the player when they view their automap. It can be changed by pressing 'N'.
- Along the right side are the following fields:
- File Name: Shows the current file name (without path).
- Modified/Saved filed. Shows if the map has been modified since
the last time it was saved.
- Special: The number of "special" walls on the current map.
These are walls that have script instructions with them to make
something special happen when the player looks at or moves onto them.
See below for more informaion.
- Cur Mode: Move/Draw/Erase - Current movement mode. See
Movement below for more details.
- The following information refers to the current draw wall (the wall that will be placed on the map, the next time you press 'x' or move in Draw mode)
- Number: Wall Number, wall character, overhead map tile number
- Descript: Short description of the wall
- VOSB bBS: Flags indicating Visible, Occludes, Symmetric, Base, Blocking, Building, and Special (in that order).
- The following information refers to the wall currently under your cursor
- Coords: The coordinates in the map that the cursor is currently at.
- Number: Wall Number, wall character, overhead map tile number
- Descript: Short description of the wall
- VOSB bBS: Flags indicating Visible, Occludes, Symmetric, Base, Blocking, Building, and Special (in that order).
- Help Menu: The mini-help menu with most frequently used
commands.
- Along the bottom, you will find: MOTION SCRIPT / DISPLAY SCRIPT - Shown at the bottom of the window, these are the script instructions assigned to the wall under the cursor (if any). See below for more information<
Movement:
Creating Walls
- To change the current wall number, press '+' or '-'. To set it to a particular value, press 'W'. If your cursor is on a wall (not a blank square), pressing '+', '-', or 'W' will only affect the wall under the cursor, not the current draw wall. You can press 'g' to set the current wall to the wall that is under the cursor.
- To place the current wall on the map, press 'x'.
- To change the direction a wall faces, press 'n', 'e', 'w', or 's'.
This setting only has an effect if the wall is not symmetrical. When
the wall contains one unique side, this determines which of the 4 sides
of the wall the unique side appears on.
- Pressing 'b' makes a wall either blocking (the player can not step onto/throught it) or non-blocking (the player can step onto/through it). When a wall is first placed, it's default blocking value is used.
- Pressing 'B' makes a wall into an empty building (or makes it not an empty building if it already was. A walls default value for building is used when it is first placed on the map.
- Pressing ' ' (space) will erase the wall currently under the cursor.
- Pressing '.' allows you to edit/create "special" code for the wall under the cursor. See the section below on editing special instructions.
Misc.
- In program mini-HELP by pressing '?'
- Save the current map by pressing 'S', save to a new filename (save as)
by pressing 'A'
- "Print" the map and detailed information about it to a text file
by pressing 'p'
- Quit the mapeditor by pressing 'q'
- Change the name of the map as it will show to the player by pressing 'N'
- all capital letters recommended.
- Change the flags for the map by pressing 'f'. Once the flags window
comes up, modify each option by pressing the key shown.
- Floor Type: Dungeon/Town (display brick "roof" and floor,
or sky and grass floor.
- Monster Density: Determines how often random monster encounters
occur (if there are monsters assigned to occor on this map). A value
of 0 means that they will never occur, and 255 occours about 1
encounter every 8 steps. Lower values decrease the chance.
- Starting Direction: If this is map number 0, this is the diretion
the player will be facing at the start of a new game
- Starting xpos/ypos: If this is map number 0, this is the position
the player will be at when starting a new game. For maps other
than map 0, this value is ignored
- Ambient Light: If the floor type is town, then light is based
on the time of day. If the floor type is Dungeon, then this value
controls how much light is visible, not counting torches, spells,
etc. 0 = no light, 4= full light.
- Copy a map square by pressing 'c' and then a register number. For
example, press 'ca' to copy into register a, then move to a new
location and press 'va' to paste from register a. There are 26 registers
(a..z) and the contents of the square (including all mapspecial code) are
stored in each register in the mapedit.rsrc file so that these squares
can be copied and pasted between maps. We recommend you store some commonly
used special squares in registers. For example, copy a generic door (with
the appropriate animation special code) in register 'd'.
- Copy a whole rectangular region by pressing 'C' and then moving
to size the rectangle, press 'c' once you are happy with the size. You
can then move the rectangular region around, and press ' ' (space) to
place a copy of the rectangle onto the map. Press 'q' or escape when
you are done making copies of the rectangle
- Resize the current map by pressing 'R'
Editing Special Instructions:
Introduction:
When it is desired that a square in a map do more than just look
like whatever wall is placed there, you will need to add special
script instructions to tell the Dragon Bane II engine how to behave
for that square. There are two scripts (optional) for each square. The
first script is executed only when the player steps onto that square
(or bumps into it if the square is blocking). This script can then
perform many actions based on this player movement. The second script
is the display script. This script is executed any time the screen is
redrawn, and the wall is in the player's view. This script is mostly
used for changing the look of the wall based on runtime parameters, but
has other more complex uses too.
- Pressing '.' when in special edit mode pops up a list of instructions
that are available. Move around the list of instructions using the
normal cursor keys. Select an instruction by pressing (enter). Cancel
the instruction by pressing either 'q' or (escape).
- Pressing 'i' when in special edit mode inserts an instruction before
the current instruction and pops up a list of instructions to insert
- Pressing 'd' deletes the current instruction.
- Pressing (enter) on an existing instruciton allows you to re-edit
the values for that instruction
- Pressing 'D' deletes the entire current script
- Pressing (tab) moves between the motion and display script
State Bits, Variables, Timers, and Toggles.
- All state in the game is controlled by state bits, variables,
counters, and toggles. These can be used to determine if a party
has found a chest with a key, unlocked a door, killed a special
monster, etc. Each map has 64 unique state bits numbered 0-63. The
value of these state bits is "local" to each map. This means that
if you set state 7 on map 0, and then check state 7 on map 1, they
are not related because each map has a different state 7. State bits 64-255 are "global" to the game. This
means that you can set state 69 in one map and check it's value
in another map. You should try to use local state bits whenever you can because there are plenty of them around. Only use global state bits when something that happens in one map affects something that happens in another map.
State bits 64-255 should be used for global game state such as killing a big dragon boss.
- Variables are more complex. There are 8 variables, shared for
the whole game. They can have a value from 0-65535. They can be
set, operated on, and checked.
- Timers count down from a given number. There are 8 timers, shared
for the whole game. They can have an initial value from 0-255 and
will count down with each step the player takes (until the reach 0).
- Toggles change in value as the player moves. There are 8 toggles,
shared for the whole game. Toggles are either on or off, and change
value in a given number of steps
- Cycles range from 0 to max, moving up or down and either ping back
and forth or wrap back to the bottom/top. There are 8 cycles, shared
for the whole game.
Using stats variables, timers, and toggles, you can create an
interactive world. You can make a disappearing wall that is only
gone for a single move. You can make a tree that grows bigger, you
can create a complex door lock, and much, much more.
- Motion Script
-
The motion script is executed only when the player steps onto the square
containing the script (or bumps into it if the wall is blocking). This
script is used for giving treasure, pressing buttons, triggering traps,
exiting to a new map, and many other uses.
- Display Script
-
The display script is executed each time the screen is redraw and the
wall is visible. This section of the script can be used to change
the look of a wall based on conditions. For example, after you pick
up a treasure chest, you need to have the wall display a blank square
instead of a treasure square
- Example:
In this example, we have a wall with an inlet and a chest in it. The chest contains a robe. If the player bumps into the wall, the script will attempt to give the player the robe in the chest. If the player has room in his characters' inventory, the robe is taken and the wall changes to become an inlet with no chest in it. If the player does not have room, the game switches to Party View and displays a graphic with a treasure chest and a message saying your party does not have enough room for the object.
-
MOTION SCRIPT DISPLAY SCRIPT
01: JUMP IF SET 019 007 01: JUMP IF CLEAR 019 003
02: GIVE OBJECT 0209 006 02: DISPLAY WALL 041
03: MESSAGE 003 0124 03: END
04: SET STATE 19
05: BREAK
06: MESSAGE 003 0125
07: END
Let's look at the lines of the motion script.
- 01: Jumps to the end of the script if state 19 is set. Here, state 19 is a local map state being used to indicate that the object available at this square has already been given. When the game starts, all state is initialized to 0, meaning the object being given away here has not yet been given out. Later in the game, after the object is given away, state 19 will change to be 1, meaning the object has been given away already. So this line will abort the program sequence in the case that the object has already been given away.
- 02: Attempt to give object number 209 (in your objects.txt, that should be a Robe), and jumps to line 6 if the party doesn't have room in their inventory.
- 03: Displays a message to the player, showing tile number 3, and text number 124.
- 04: Sets state 19 (to indicate that this object has been found).
- 05: Stops execution.
- 06: (which we get to only if we didn't successfully give the object displays a message with tile 3 and text number 125 (saying that you found something but didn't have room). Note that text number 125 (in text_game.txt) has a "@o" in it. This will be expanded during the game to contain whatever object was last referenced in your mapspecial code. In this case, the last instruction to reference an object was line number 2 which referenced object 209. So the name for object 209 "ROBE" will be replaced for the "@o" in text #125.
- 07: End of motion script marker
Now lets look at the display sript.
- 01: Jumps to line 3 if state 19 is clear. This means that if you have not found the object yet, display whatever wall was placed there in the map editor (in this case, probably a chest).
- 02: (which only executes if state 19 is set) changes this wall to display wall number 41. So this script displays the wall from the map editor if you have not found the object yet, and displays a different wall after you have found the object (to make the chest disappear).
- 03: Ends the script