digging a hole problem

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
Granamir
Posts: 202
Joined: Wed Jan 07, 2015 7:19 pm

digging a hole problem

Post by Granamir »

Hi everyone,
i'm trying to dig a hole (forest_chasm) to go underneath map. if i put the chasm directly in my map everything is ok but if i spawn chasm after digging i have a visual problem, i see chasm border but inside (where hole would be) i see normal forest_ground i used in map...even if i still fall inside chasm.
Anyone has any clue on how to solve this problem?
Thanks
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: digging a hole problem

Post by minmay »

Most tiles work by spawning entities. For example:

Code: Select all

defineTile{
	name = "dungeon_floor",
	editorIcon = 192,
	color = {150,150,150,255},
	builder = "dungeon",
	floor = {
		"dungeon_floor_dirt_01", 1,
	},
	ceiling = {
		"dungeon_ceiling", 1,
	},
	wall = {
		"dungeon_wall_01", 35,
		"dungeon_wall_02", 35,
		"dungeon_wall_drain", 2,
	},
	pillar = {
		"dungeon_pillar", 1,
	},
	ceilingEdgeVariations = true,
	ceilingShaft = "dungeon_ceiling_shaft",
}
A "dungeon_floor_dirt_01" entity is spawned on dungeon_floor tile to provide the floor model. You can turn this floor into a pit with no problem; just destroy the dungeon_floor_dirt_01 entity and spawn your pit.
But if you look at the definition for a heightmapped tile:

Code: Select all

defineTile{
	name = "forest_ground",
	editorIcon = 200,
	color = {70,150,70,255},
	builder = "dungeon",
	-- floor geometry is generated by heightmap
	heightmapMaterial = "forest_ground_01",
	diggable = true,
	moveSound = "party_move_grass",
	automapTile = "grassy_ground",
}
Notice that this tile doesn't spawn any entities. Instead, it specifies a heightmap material. The level's heightmap object effectively builds a contiguous mesh out of all the heightmapped tiles on the level. There is no longer a floor entity to destroy, so you cannot modify the heightmapped squares at runtime.
As for why it works if you place the pit in the editor:

Code: Select all

defineObject{
	name = "base_pit",
	components = {
		{
			class = "Pit",
		},
	},
	replacesFloor = true,
	killHeightmap = true,
	placement = "floor",
	editorIcon = 40,
	automapIcon = 108,
}
If an entity has "killHeightmap", the heightmap mesh will not be built over that tile.
As far as I know, the heightmap mesh can never change after the dungeon has been loaded. If you add heightmap or killHeightmap objects after the dungeon is loaded, they will have no effect on the heightmap until the player saves and reloads their game.
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.
Granamir
Posts: 202
Joined: Wed Jan 07, 2015 7:19 pm

Re: digging a hole problem

Post by Granamir »

Thanks for fast reply and precise explanation
if i understood this menas that is absolutely impossible to do what i want...
...big problem for me, means i have to change 2 maps i already built (i kept the hole as last thing to put)
...i feel like i want to cry T_T...too much limitations
Post Reply