ascii maps in dungeon.lua

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
Post Reply
User avatar
FeMaiden
Posts: 290
Joined: Wed Jan 16, 2013 8:16 am

ascii maps in dungeon.lua

Post by FeMaiden »

I just thought of something.

if I wanted to remake my mod from scratch, redoing all the item placements and scripts but I don't want to redraw all the maps.
could I therotically open up my dungeon.lua file

then copy paste all the dungeon ascii(or hexadecimal or whatever those numbers mean) maps into the new dungeon.lua?

what I am referring to is this

Code: Select all

--- level 1 ---

newMap{
	name = "North West",
	width = 32,
	height = 32,
	levelCoord = {1,0,0},
	ambientTrack = "forest_night",
	tiles = {
		"castle_arena_floor",
		"forest_ground",
		"forest_hedge",
		"forest_trail",
		"forest_trees",
		"forest_wall",
	}
}

loadLayer("tiles", {
	6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
	6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,3,
	6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,3,
	6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,3,
	6,5,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,
	6,5,2,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
	6,5,2,4,2,2,2,2,2,2,2,2,2,2,2,2,4,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,
	6,5,2,4,2,5,5,5,5,5,2,2,2,2,2,2,4,2,2,2,2,2,2,2,5,5,5,5,5,5,5,3,
	6,5,2,4,2,5,5,5,5,5,2,1,1,1,1,1,1,1,1,1,1,1,1,2,5,5,5,5,5,5,5,3,
	6,5,2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,1,1,1,1,1,1,2,5,2,4,2,3,
	6,5,2,4,2,2,1,1,1,1,2,5,2,4,4,1,1,1,1,1,1,1,1,1,1,1,2,5,2,4,2,3,
	6,5,2,4,2,2,1,1,1,1,2,5,2,4,2,1,1,1,1,1,1,1,1,1,1,1,2,5,2,4,2,3,
	6,5,2,4,2,2,2,2,2,2,2,5,2,4,2,1,1,1,1,1,1,1,1,1,1,1,2,5,2,4,2,3,
	6,5,2,4,2,5,5,5,5,5,5,5,2,4,2,2,2,2,2,2,2,2,2,2,2,2,2,5,2,4,2,3,
	6,5,2,4,2,5,5,5,5,5,5,5,2,4,2,5,5,5,5,5,5,5,5,5,5,5,5,5,5,4,2,3,
	6,5,2,4,2,5,5,5,5,5,5,5,2,4,2,5,5,5,5,5,5,5,5,5,5,5,5,5,5,4,2,3,
	6,6,6,4,6,6,6,6,6,6,6,6,6,4,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,4,6,3,
})


spawn("forest_heightmap",1,0,3,0,"forest_heightmap_1")
spawn("forest_day_sky",0,0,2,0,"forest_day_sky_4")
spawn("beach_rock_2x1",31,1,0,0,"beach_rock_2x1_2")
spawn("beach_rock_2x1",30,31,1,0,"beach_rock_2x1_3")
spawn("forest_exit",31,5,1,0,"forest_exit_21")
spawn("forest_exit_rock_tunnel",3,31,2,0,"forest_exit_rock_tunnel_2")
spawn("forest_exit_rock_tunnel",13,31,2,0,"forest_exit_rock_tunnel_3")
spawn("forest_exit_rock_tunnel",29,31,2,0,"forest_exit_rock_tunnel_4")
spawn("beach_rock_3x1",2,31,3,0,"beach_rock_3x1_26")
spawn("beach_rock_3x1",6,31,3,0,"beach_rock_3x1_31")
spawn("beach_rock_3x1",12,31,3,0,"beach_rock_3x1_32")
spawn("beach_rock_3x1",16,31,3,0,"beach_rock_3x1_33")
spawn("beach_rock_3x1",28,31,3,0,"beach_rock_3x1_34")
spawn("forest_wall_text_short",16,6,3,0,"forest_wall_text_short_4")
forest_wall_text_short_4.walltext:setWallText("Lending Library")
spawn("forest_wall_text_long",4,24,0,0,"forest_wall_text_long_8")
forest_wall_text_long_8.walltext:setWallText("Head counselor's Office")
spawn("forest_wall_text_long",13,24,1,0,"forest_wall_text_long_9")
forest_wall_text_long_9.walltext:setWallText("Greeting and Assembly Hall")
spawn("forest_wall_text_long",27,18,0,0,"forest_wall_text_long_10")
forest_wall_text_long_10.walltext:setWallText("Maintenance and Storage")
spawn("dungeon_door_wooden_double",28,16,2,0,"dungeon_door_wooden_double_14")
spawn("dungeon_door_wooden_double",14,25,1,0,"dungeon_door_wooden_double_18")
spawn("dungeon_door_wooden_double",16,7,2,0,"dungeon_door_wooden_double_19")
spawn("dungeon_door_wooden_double",6,24,3,0,"dungeon_door_wooden_double_20")
spawn("barrel_crate_block",26,12,2,0,"barrel_crate_block_1")
spawn("barrel_crate_block",27,12,2,0,"barrel_crate_block_2")
spawn("barrel_crate_block",28,12,2,0,"barrel_crate_block_3")
spawn("barrel_crate_block",29,12,2,0,"barrel_crate_block_4")
spawn("barrel_crate_block",29,13,3,0,"barrel_crate_block_5")
spawn("barrel_crate_block",26,13,1,0,"barrel_crate_block_6")
spawn("barrel_crate_block",26,14,1,0,"barrel_crate_block_7")
spawn("barrel_crate_block",29,14,3,0,"barrel_crate_block_8")
spawn("claw_hammer",26,12,0,0,"claw_hammer_1")
spawn("medicine_healing",27,12,0,0,"medicine_healing_4")
spawn("medicine_healing",26,13,3,0,"medicine_healing_5")
spawn("medicine_healing",28,12,0,0,"medicine_healing_6")
spawn("throwing_axe",29,13,1,0,"throwing_axe_2")
spawn("throwing_axe",29,14,1,0,"throwing_axe_3")
spawn("throwing_axe",26,14,3,0,"throwing_axe_4")
spawn("mole_jerky",29,12,0,0,"mole_jerky_8")
spawn("mole_jerky",29,12,1,0,"mole_jerky_9")

User avatar
Dr.Disaster
Posts: 2876
Joined: Wed Aug 15, 2012 11:48 am

Re: ascii maps in dungeon.lua

Post by Dr.Disaster »

In theory yes. The dungeon.lua file defines all the layers (tiles, height, noise, elevation ..) of a map and then places all objects into it. Of course you need to be aware of which numbers do what.
User avatar
FeMaiden
Posts: 290
Joined: Wed Jan 16, 2013 8:16 am

Re: ascii maps in dungeon.lua

Post by FeMaiden »

Dr.Disaster wrote:In theory yes. The dungeon.lua file defines all the layers (tiles, height, noise, elevation ..) of a map and then places all objects into it. Of course you need to be aware of which numbers do what.
yes, and i realize in that regard, I have no idea what each number actually "does"

but like..if I just copied all the text over and pasted it into the new mod, aren't those just instructions to the editor on how to build the maps?

it would just literally clone my old mod wouldn't it?

my idea was to not paste any of the spawn item scripts but merely to paste over that 32*32 map grid so I don't have to paint it all over again in the editor

again, maybe I should not be asking this here, I could always just try it and see what happens, I have nothing to lose.


edit : it worked.
this will save me a lot of time if I do end up rebuilding my mod
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: ascii maps in dungeon.lua

Post by minmay »

The number is just the index in the tiles table. So in the one you posted, 1 is castle_arena_floor, 2 is forest_ground, 3 is forest_hedge, etc.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
User avatar
FeMaiden
Posts: 290
Joined: Wed Jan 16, 2013 8:16 am

Re: ascii maps in dungeon.lua

Post by FeMaiden »

minmay wrote:The number is just the index in the tiles table. So in the one you posted, 1 is castle_arena_floor, 2 is forest_ground, 3 is forest_hedge, etc.
okay, thanks for clearing that up.
Post Reply