Difference between revisions of "T4 Modules Howto Guide/Zones"
Line 175: | Line 175: | ||
<> field of the zone</p> | <> field of the zone</p> | ||
− | Go back to [[ | + | Go back to [[T4 Modules Howto Guide]] |
Revision as of 22:11, 6 July 2013
Contents
- 1 Zones: Your local adventurer hangouts
- 1.1 Zone Description: zone.lua
- 1.2 Generator
- 1.2.1 map
- 1.2.1.1 engine.generator.map.Cavern
- 1.2.1.2 engine.generator.map.Empty
- 1.2.1.3 engine.generator.map.Forest
- 1.2.1.4 engine.generator.map.GOL
- 1.2.1.5 engine.generator.map.Heightmap
- 1.2.1.6 engine.generator.map.Maze
- 1.2.1.7 engine.generator.map.Roomer
- 1.2.1.8 engine.generator.map.Rooms
- 1.2.1.9 engine.generator.map.Static
- 1.2.1.10 engine.generator.map.TileSet
- 1.2.1.11 engine.generator.map.Town
- 1.2.2 actor
- 1.2.3 object
- 1.2.4 trap
- 1.2.1 map
- 1.3 Additional file contents
- 1.4 Static maps
- 1.5 Travelling between zones
- 1.6 Word of DarkGod
Zones: Your local adventurer hangouts
Zones are description files for areas. The dungeon is a zone, the ice themed cave is a zone, the overland map is a zone, the town is a zone. They can be relatively simple or complex, and can be interconnected in various ways.
What a zone is to the module writer is a directory in the /data/zones folder with 5 files in it:
File | Purpose |
---|---|
zone.lua | Zone description file |
grids.lua | Description of the zone terrain |
npcs.lua | NPCs that exist in the zone |
objects.lua | Objects in the zone |
traps.lua | Traps in the zone |
Zone Description: zone.lua
The zone name, as referred to by other files, is the same as the folder name that this file is in.
Variable | Effect |
---|---|
name | Display name of this zone. May contain punctuation and spacing. |
level_scheme | If "player", scale zone and NPC levels to match player level, if "fixed", do not scale NPC levels. |
level_range | If level_scheme is "player", this limits the min and max that NPC levels can scale to. |
max_level | Depth of a multi-level dungeon |
actor_adjust_level | See below under "On level_scheme and level_range" |
width | Width of levels. No effect if static level generated. |
height | Height of levels. No effect if static level generated. |
all_remembered | If true, level starts explored. |
all_lited | If true, level starts lit. |
persistant | If not set, randomizes the level again every time it is entered. If true it saves one level per file. If "zone" it saves all levels in a zone file. If "memory" it saves the level with the mail savefile. |
generator | Defines the generators used for this zone, read below. |
levels | Used to override zone defaults for single levels, such as to add a static boss level at lowest level of zone. |
Generator
There are four kinds of generators at the time of writing. You can only select one of each type per zone, though you can override this in the levels variable.
map
engine.generator.map.Cavern
- Generates a caven-like level. Used e.g. for Ardhungol in the tome module.
engine.generator.map.Empty
- makes an empty level
- makes an empty level
engine.generator.map.Forest
- Generates a forest level with possible ponds of water. Used for the Trollshaws.
- Generates a forest level with possible ponds of water. Used for the Trollshaws.
engine.generator.map.GOL
- GOL is game of life I should rename it
engine.generator.map.Heightmap
- Heightmap is just a bad experiment;
- Heightmap is just a bad experiment;
engine.generator.map.Maze
- Maze makes well, a maze...like in .. the maze ;)
engine.generator.map.Roomer
- Roomer is the standard dungeon builder
engine.generator.map.Rooms
- yeah Rooms is badly named and half working
engine.generator.map.Static
- Loads a map file from the data/maps/ folder. It is used e.g. for towns or special levels (the map is then fixed) or for placing special fixed rooms/structures in a random map (e.g. the last level of Amon-Sûl).
engine.generator.map.TileSet
- TileSet splits the level in tiles of 3x3, 5x5, .. (customizable) each with a set of defined tiles possibilities and it randomly places them, matching existing ones. Examples are the ancient elven ruins, the moria, the first level of the lost merchant quest
engine.generator.map.Town
- Generates a random town composed by L-shaped and rectangular buildings. Used e.g. for the Rak'shor Pride.
actor
engine.generator.actor.Random
object
engine.generator.object.Random
trap
engine.generator.trap.Random
Additional file contents
The files grids.lua, npcs.lua, objects.lua and traps.lua are used to load or define the features available in the zone.
At its simplest, a load() call to one of the files defined in the /data/general/ directory is used, but zone special features can also be defined here, such as ice tiles in a ice cave or a boss that appears only in that zone.
The reason for this is so you can have only orcs or trolls appear in your zone, with a forest tileset and only outdoor traps. This is also one of the main reasons for segmenting your definition files.
Static maps
Travelling between zones
Word of DarkGod
On level_scheme and level_range
<> max_level is the "physical" depth
<> and level_range is the range of levels allowed
<> if the scheme is set to "fixed", or not set, then actors will only have their natural level
<> if it is set to "player" then the zone calls game:getPlayer() to get a player, takes its level and uses it to select a level for the zone
<> imagine:
<> if you haev a zone with max_level = 5; level_range={10,20}
<> then if a level 12 player enters, the zone "levels itself" to be level 12 for the first level and then one more per level
<> basically it means that you can have zones that levelup with the player, as to provide a challenge even if the player is not at the exact right level
<> actors are always created as level 1, then they are leveled up to theuir minimun level (their own level_range)
<> then the zone force levelup to the selected level\<dg_> using the
<> actor_adjust_level = function(zone, level, e) return zone.base_level + e:getRankLevelAdjust() + level.level-1 + rng.range(-1,2) end,
<> field of the zone
Go back to T4 Modules Howto Guide