DRL > Discussion
Sanity check : Special level format
Kornel Kisielewicz:
Modding is steadily on it's way. I plan to make it as painless as possible. As a teaser, and sanity check, I post here the complete code for Halls of Carnage. Please comment on it... is it readable? What could be done better?
--- Code: (lua) ---
Levels("SPEC2",{
name = "Halls of Carnage",
entry = "On level @1 he ventured into the Halls of Carnage.",
welcome = "Suddenly you feel a lust for blood...",
level = {11,14},
Create = function ()
Level.fill(CELL_PRWALL)
Level.tile(".",CELL_FLOOR)
Level.tile("W",CELL_PRWALL)
Level.tile("X",CELL_RWALL)
Level.tile("#",CELL_WALL)
Level.tile("%",CELL_BWALL)
Level.tile(",",CELL_BLOOD)
Level.tile("+",CELL_DOOR)
Level.tile(">",CELL_STAIRS)
Level.tile("3",CELL_FLOOR,{ being = NPC_SEREGANT })
Level.tile("5",CELL_FLOOR,{ being = NPC_IMP })
Level.tile("7",CELL_FLOOR,{ being = NPC_SKULL })
Level.tile("6",CELL_FLOOR,{ being = NPC_DEMON })
Level.tile("8",CELL_FLOOR,{ being = NPC_CACODEMON })
Level.tile("9",CELL_FLOOR,{ being = NPC_BARON })
if DIFFICULTY == 1 then
Level.tile("8",CELL_FLOOR,{ being = NPC_DEMON })
Level.tile("9",CELL_FLOOR,{ being = NPC_CACODEMON})
end
if DIFFICULTY > 2 then
Level.tile("8",CELL_FLOOR,{ being = NPC_KNIGHT })
end
if DIFFICULTY > 3 then
Level.tile("7",CELL_FLOOR,{ being = NPC_CACODEMON })
end
Level.tile("Z",CELL_FLOOR,{ item = ITEM_AMMO })
Level.tile("!",CELL_FLOOR,{ item = ITEM_BFG9000 })
Level.tile("^",CELL_FLOOR,{ item = ITEM_SCGLOBE })
Level.tile("=",CELL_LAVA)
Level.tile("|",CELL_FLOOR,{ item = ITEM_ROCKET })
Level.tile("[",CELL_LDOOR)
Level.put(2,2,{
".................................#.|..|..|.#...#..===..X.......6............",
"........................................3..%...#,.===7.X..XXXXXXXXX.XXXXXXX.",
"...#%%##+##........#...###%%##...........,,%...[,.===..[..X.........6.......",
"...#.,,...#........#.......,,#..........,,,#...#,.===..X..X.XXXX.XXXXXXXX.X.",
"...#..........3....#.3.......#...#####+#%%##...#..===..X..X6X.8.........X.X.",
"...+...............#.........#.................#..===..X..X.X.XXXXXXX.X.X.X.",
"...#,..3...........+...,,,...#.........#.......#.7===..X..X.X.X...9...X...X6",
"...#%#........######..#%%##............#...#...#,.===..X..X.X.X.WWWWW.X.X.X|",
".,,,..................#......#......3.,%...#...[,.=^=..[..X.X.X.W|!|W.X.X..^",
"......................#...,,.%.......,,%...%,..#,.===..X6.X.X.X.W...W.X.X.X|",
"...##%%+######........#..3,,,%......,,.#..,%,..#..===..X..X.X.X.W[WWW.X.X.X.",
"...#..,......+...........,,..#...##%%%##...%...#..===..X..X.X.X.....9.X...X.",
"...#......,3.#..........##%%%#.............#...#,.===7.X..X.X.XXXXXXXXX.X...",
"...#.....##%%#........................######...[,.===..[..X.X8.......8..X.X.",
"......................................#........#,.===..X..X.XXXXXX.XXXXXX.X.",
".,,######..........####%%%##+###......+...3....#.7===..X..X6..............X6",
".,,+^|..#......3...#,,,,,.3...........#........#..===..X..XXXXX.XXXXX.XXXXX.",
".,,#>|..#..........#.,,,................3......#..===..X.........6..........",
})
Level.visited(3)
Level.player(8,18)
end,
})
--- End code ---
Ask about anything you want :)
chalup:
All is clear except for some magical entries like:
--- Code: ---level = {11,14},
Level.visited(3)
Level.player(8,18)
Level.put(2,2,
--- End code ---
I suppose that {11,14} means that stairs to this level can appear as a special level between 11th and 14th phobos base level, but i have no clue about other three.
Kornel Kisielewicz:
Yeah, level is the level range.
Level.visited will be removed and replaced with something more readable -- it is a legacy feature for handling the level found info in the beginning of the mortem.
Level.player(8,18) places the player at x=8, y=18 :P
Level.put(2,2, means that the following map will be placed at x=2, y=2.
Silhar:
Seems clear enough, even for someone who doesn't know how to program...
About making modding easier, right now nothing comes to my head.
Styro:
Looks great! It is very easy to understand.
I am really looking forward to the mod ability. I want to try making an X-Com based mod using the DoomRL engine. :D
Navigation
[0] Message Index
[#] Next page
Go to full version