| Overview | Screenshots | Downloads | News | Documentation | Thanks | Simugraph Home Page |
Up to date with H-World 0.2.4
| Property | Description |
|---|---|
| type = file | Flag to let the H-World engine know that this is a file based level |
| file = [module]/data/castle_boss.lvl | This is the name of the level layout file (a text file actually). (*) |
| unseen = 32 | Image number to show for areas outside the level (32=black tile) (*) |
| title = Castle cellar level 3 | Level title, displayed in the lower right of the level view. (*) |
| random_chance = 0 | Random chance per square to create items and monsters. It is given in n/10000 chance per square. 0 means no random items and monsters on this level. (*) |
| width = 40 | Width of the level. Important for file based levels. Must match the actual width of the layout file, otherwise H-World might crash. (*) |
| height = 40 | Height of the level. Important for file based levels. Must match the actual height of the layout file, otherwise H-World might crash. (*) |
The syntax is best described with an example at hand. Open [module]/data/home.lvl in an text editor. Make sure your editor can read text files with unix style newlines.
The level layout file start with a section defining the level properties:
section description width = 40 height = 40 end sectionWidth and height are always required. Optionally the section can also define probability chains for items and monsters:
section description width = 5 height = 5 chest-0.ident = chest chest-0.chance = 30 chest-1.ident = marble_chest chest-1.chance = 60 mon-0.ident = skeleton_warrior mon-0.chance = 10 mon-1.ident = skeleton mon-1.chance = 10 mon-2.ident = rock_lizard mon-2.chance = 10 end sectionUpon executing a chain, the item/monster generator steps through the chain. On each entry a roll will be made to see if this entry should be generated. If the roll succeeds the item is created and placed and the chain ends. Otherwise the next entry from the chain is tested.
The level properties are followed by a mapping of characters to features, items and grounds. The mapping section is closed by a line containing a single capital Q.
After the character mappings, the level layout is given. This is a matrix of characters that have been mapped to features, items and grounds.
After the level layout, additional item/monster placement instructions are given. They continue until the and of the file.
There are two styles of feature definitions: named features, and anonymous features.
Example of a named feature:
W:f:c_wall_1 img=feature_default
This line maps the character W to a feature called c_wall_1. The named features are listed in [module]/data/features.sects You can add new features with custom images to [module]/data/features.sects easily.
I.e. assuming you want to add a new stair image, you just need to add this to [module]/data/features.sects:
begin section my_down_stairs img = [module]/data/custom/stairs_down.png end section
You need to supply the stairs_down.png image so that the H-World engine know how to display this kind of stairs. To use it you level definition, just write:
>:f:my_down_stairs img=feature_default
This maps the character > to the ne w down stairs.
Anonymous features work the same as named features, but instead of a feature name, an image number is given:
a:f img=182
This doesn't allow to use user-defined graphics, and the image numbers are not fully documented, thus the use of anonymous features is not recommended.
Item mappings work just like feature mapping, except that the type is 'i' instead of 'f'. H-World does not distinguish monsters and items, thus you can use this to place monsters, too.
b:i:chair_right img=feature_default
Items are defined in [module]/data/things.sects, monsters are defined in [module]/data/beings.sects. Look there for item and monster names.
Chain mappings work just like item mapping, except that the type is 'c' instead of 'i'.
p:c:mon img=feature_default
In this case the chain "mon" will be executed. The chain must be defined in the level properties, e.g.:
section description ... mon-0.ident = skeleton_warrior mon-0.chance = 10 mon-1.ident = skeleton mon-1.chance = 10 mon-2.ident = rock_lizard mon-2.chance = 10 ... end section
These mapping define the type of ground that is generated during level creation for each ground character that is given in the level layout.
In general there are two ground types:
The ground character mapping syntax is
.:ground img=10000
Textured floors use image numbers of 10000 and upwards. The number is mapped to one of the image definitions from the level template:
images = 1 image[0] = ./default/data/tiles.pngE.g. texture number 10000 is mapped on the first image that was loaded by the level template.
Tiled floors use numbers from 0...9999. The numbers map to the images loaded from the daten128.pak file and therefore are only of limited use for mod makers.
After item, feature and ground mappings the actual level layout is given:
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW ........................................ W$ $ $ $W W W ........................................ W W W W ........................................ W W ........................................ W W ........................................ W W W W ........................................ W$ W W W ........................................ W WWWWWWWWWWWWWWWWWWWWWWW ........................................ W W W ........................................ W W W ........................................ W W W ........................................ W$ WWWWW W ........................................ W &WW& W ........................................ W WWWW W ........................................ W WW W ........................................ W W ........................................ W$ W ........................................ W W ........................................ W W&W W ........................................ W WWWWW W ........................................ W &WWW& W ........................................ W$ WWWWW W ........................................ W W&W W ........................................ W W ........................................ W W ........................................ W W ........................................ W$ WW W ........................................ W WWWW W ........................................ W &WW& W ........................................ W WWWWW W ........................................ W W W ........................................ W$ W W ........................................ W WWWWWWWWWWWWWWWWWWWWWWW ........................................ W W W ........................................ W W W ........................................ W W ........................................ W W W ........................................ W W W ........................................ W$ W W ........................................ WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW ........................................
The lines come in pairs. The first line of a pair defines the feature and items. Each character defines the feature or item to be placed on the corresponding square. The second line defines the grounds. Each character defines the ground of corresponding square.
The level layout above only allows to give one item per square. Sometimes this isn't enough. Thus you can place additional items and monsters with entries after the level layout:
skeleton 10, 10
This places a skeleton on square 10,10. You can add any number of additional item and monster placements after the level layout.
This works quite similar to placing items. The syntax is:
^100 1,1
The ^ character is needed to tell triggers from items to be placed. After the ^ character, the trigger number is given. The trigger number is just handed as a parameter to trap_triggered() in [module]/scripts/traps.lua. Thus it is easy to define new triggers by extending the trap_triggered() function.
The second line defines the position of the trigger. There can be only one trigger per square, but you can define triggers from 0..255, so you could use triggers that trigger multiple effects if you need.