Object with More than 1 offset or surface??

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
Eleven Warrior
Posts: 752
Joined: Thu Apr 18, 2013 2:32 pm
Location: Australia

Object with More than 1 offset or surface??

Post by Eleven Warrior »

Hi all.

I am using the book shelf from cosy dungeons and was wondering is it possible to have more than 1 surface component on the object, that way I can have items on the middle, bottom and top shelves?

Thxs for any help :)

Code: Select all

defineObject{
	name = "ph_temple_bookshelf_alcove",
	baseObject = "dungeon_alcove",
	tags = { "ph_cosy_dungeon" },
	components = {
	{
	class = "Model",
	model = "mod_assets/cosy_dungeon/TempleBookShelfAlcove.fbx",
	staticShadow = true
	},
	{
	class = "Surface",               ---Can I add more surfaces to this object or do I have to add socket component ---
	offset = vec(0, 0.6, 0.26),
	size = vec(1.6, 0.1, 0, 0),
	--debugDraw = true
	},
	{
	class = "Clickable",
	offset = vec(0, 0.62, 0.17),
	size = vec(1.2, 0.8, 0.6),
	--debugDraw = true
	}
	}
}
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: Object with More than 1 offset or surface??

Post by minmay »

Multiple SurfaceComponents work, but ClickableComponents will always try to go for the "first" SurfaceComponent. So, in the onClick function for all of your ClickableComponents you should disable all SurfaceComponents except for the one that you want to accept the item.
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.
Post Reply