In this tutorial I'm going to explain a modmaking trick that can add great customization to your mod; I'm talking about [b]changing[/b] dungeon types. Basically what we're going to do is change what a dungeon level [i]looks like[/i]. For example, once you've grasped the concepts discussed here you will be able to turn the Den of Evil into an Ice Cave (just like the ones in Act 5), or maybe replacing the Maggot Lair with even more Palace Cellar Levels. The options are many, but for the scope of this tutorial I'm going to show how to make the Den of Evil look like an Act 5 Ice Cavern.

Two files are required for this tutorial, namely [color=yellow]levels.txt[/color] and [color=yellow]lvlmaze.txt[/color]. We will start explaining some of the key columns in levels.txt for this kind of modification:

[color=orange][b]Pal[/b][/color]: this column control which palette the game is going to use for a level. It is very important that you set the correct palette here, otherwise your graphics can turn out weird. Here's what the numbers in this column mean:

[b]0[/b] - This level uses the Act 1 palette

[b]1[/b] - This level uses the Act 2 palette

[b]2[/b] - This level uses the Act 3 palette

[b]3[/b] - This level uses the Act 4 palette

[b]4[/b] - This level uses the Act 5 palette

[color=orange][b]LevelType[/b][/color]: this colum determines which set of graphic tiles the level will use. To know what the numbers in this column mean, refer to [color=yellow]lvltypes.txt[/color]. For example, LevelType=33 means the level use the graphic tiles from the Act 5 Ice Caves.

[color=orange][b]Vis0-Vis7[/b][/color]: control how levels connect with each other. Refer to the Creating Multi-Level Dungeons tutorial by SiLenTx to understand how to work with these columns;

[color=orange][b]Warp0-Warp7[/b][/color]: control which [b]warps[/b] a level use. A warp is the object that connect levels; the cavern entrances in act 1, or the staircases all over the game are examples of warps. To know what the numbers in these columns mean, refer to [color=yellow]lvlwarp.txt[/color]. For example, Warp 64 is the stairs connecting Travincal to the Durance of Hate level 1.

I'll now detail the process of making the Den of Evil look just like an Act 5 Ice Cave: Open levels.txt, and find the Den of Evil row; it is the row called [b]Act 1 - Cave 1[/b]. We want to use Act 5 graphic tiles for this level, so we put [color=yellow]4[/color] in the [b]Pal[/b] column, in order to avoid palette problems. Next we need to change its [b]LevelType[/b]; as stated before, the Act 5 Ice Caves are LevelType 33, so put [color=yellow]33[/color] as the LevelType of the Den of Evil.After that, we need to modify the warp used to connect the Den of Evil to the surface. To do this, you will modify values in the [b]Warp0[/b] column. Check the Warp0 value for the Den of Evil. It's 4. To see what kind of warp this is, open LvlWarp.txt. Warp Id 4 = Act 1 Cave Up, as expected. The one we want is [b]Id 73, Act 5 Ice Caves Up[/b]. So, simply change the Warp0 of the Den of Evil from 4 to [color=yellow]73[/color]. This is all we will modify in levels.txt (for now). Save it and exit.

Now open lvlmaze.txt. The important columns in this file are [color=orange]SizeX[/color], [color=orange]SizeY[/color], and [color=orange]Rooms[/color]. Originally for the Den of Evil (Act 1 - Cave 1), we have

Rooms = 1

SizeX = 24

SizeY = 24

We want to change the Den of Evil into an Ice Cave; have a look at the column called [b]Act 5 - Ice Caves 1[/b], at the end of the lvlmaze.txt file. These are the values you will find:

Rooms = 10

SizeX = 16

SizeY = 16

To complete the modifications, change the [b]Rooms[/b], [b]SizeX[/b], and [b]SizeY[/b] columns of the Den of Evil to [color=yellow]10[/color], [color=yellow]16[/color], [color=yellow]16[/color] respectively (exactly as the ice cave). Save and exit.

You are now ready to enter the game and test the changes to the Den of Evil. If all was modified correctly, the Den will look exactly as an Act 5 Ice Cave!!

There is a small problem though, and you will soon notice it: the original Den of Evil has only one warp (the one leading to the Blood Moor). However, [i]the Act 5 Ice Caves have 3 warps[/i]. That means when you change the Den into an Ice Cave, you will get 2 extra warps!! You have to make sure the extra warps are connected somewhere. In our example they aren't connected anywhere yet, and so Diablo 2 will give you this warning uppon approaching one of these warps:

[color=orange][i]Warning

Location : C:ProjectsDiablo2SourceD2CommonDRLGRoomTile.cpp, line #686

Expression : ptWarp[/i][/color]

Ok, so we need to go back to levels.txt and do some more changes (again I refer you to the Multi-Level Dungeons tutorial by SiLenTx, knowledge on the Vis columns is required for the following changes). We must link these two extra warps somewhere; this is totally up to you and your needs, but I'll detail here how to:

1) use one warp to connect The Den of Evil with the Underground Passage Level 1

2) use one warp to connect The Den of Evil with the Underground Passage Level 2

The following diagrams show what we will accomplish with this change:

[u][b]Original level disposition[/b][/u]

Stony Field

|

v

Underground Passage 1 -> Dark Wood

|

v

Underground Passage 2

[u][b]Level disposition after the changes[/b][/u]

Stony Field

|

v

Underground Passage 1 -> Dark Wood

|

v

[color=yellow]Den of Evil |

v

Underground Passage 2

Start by opening levels.txt and looking at the row called [b]Act 5 - Ice Cave 1[/b]. This level uses the Vis0, Vis1, Vis2 columns. Since we've changed the Den of Evil into a level of the same type as this one, [b]we must use[/b] the Vis0, Vis1, Vis2 columns for the Den of Evil as well, otherwise it won't work. The changes in the Vis columns will be:

Act 1 - Cave 1 (Den of Evil, Id = 8 ): Vis0 = 2, Vis1 = 14, Vis2 = 10

Act 1 - Cave 3 (Underg. Passage 1, Id = 10): Vis4 = 8

Act 1 - Cave 3 Treasure (Underg. Passage 2, Id=14): Vis1 = 8

You also need to enable the Warp1 and Warp2 in the Den of Evil, simply put Warp1 = [color=yellow]74[/color] and Warp2 = [color=yellow]75[/color] in the Act 1 - Cave 1 row, exactly as what is found in the Act 5 Ice Cave row. Save and exit, the warps problems are now solved and you can test it going to the Den of Evil again. This time, there will be no [i]ptWarp[/i] warning, and the extra warps will be connected to the Underground Passages, levels 1 and 2.

This completes the modifications, you have now a working Ice Cave in Act1!

I'd like to add some comments though:

1 - The value in the [b]Rooms[/b] column indicates the size of the dungeon; the bigger the value, the bigger the dungeon is. You can change this to whatever you want, but keep in mind too small values may not work in all cases. For example, if you left Rooms = 1 for the Den of Evil and changed it into an Ice Cave, you would get this assertion uppon entering the game and approaching the Den:

2 - What we did was basically only change the graphic tiles the level uses. Objects that would spawn in an Act 5 Ice Cave (like Evil Urns for example) will not appear in our Icy Den of Evil, unless we also modify the [color=orange]ObjGrp0-ObjGrp7[/color] and [color=orange]ObjPrb0-ObgPrb7[/color] columns in levels.txt; they control what objects can spawn on a level.

3 - [color=orange]Corpsefire will not appear in this Icy Den of Evil[/color]. When you change a level type of a dungeon, you also apparently change what [b]ds1[/b] files a level uses. The ds1 files with Corpsefire will not be chosen when the game generates an Ice Cave. You can set Corpsefire to appear in other area of the game (preferably a static area, like the Burial Grounds for example), using a DS1 Editor which can be downloaded at our [url=https://d2mods.info/forum/dload.php][u]File Center[/u][/url].