Grimrock 2 editor: Button disableSelf has no function!

Have trouble running Legend of Grimrock 2 or do you have questions about the purchasing options? Look for help here.
Post Reply
User avatar
Illidan
Posts: 19
Joined: Sat Mar 12, 2016 3:23 pm
Location: Germany

Grimrock 2 editor: Button disableSelf has no function!

Post by Illidan »

I don't know if it is a bug but it is very anoying for me that activating the checkbox "disableSelf" for buttons in Grimrock 2 editor does not work/has no effect.
Example: Take a lever and a door, activte the checkbox "disableSelf" of the lever-component and it works, it opens or closes the door and after that it has itself deactivted and no function anymore.
But, when you do the same with any button, activating the checkbox "disableSelf" has no effect. The button never deactivates itself.
Is this a bug or do I miss something? I really would like to have this function enabled for buttons because I need it for my custom dungeon.
minmay
Posts: 2768
Joined: Mon Sep 23, 2013 2:24 am

Re: Grimrock 2 editor: Button disableSelf has no function!

Post by minmay »

You're right, it doesn't work. Fortunately, this is very easy to fix. Just define all your buttons with this onActivate hook:

Code: Select all

defineObject{
	name = "wall_button",
	baseObject = "wall_button",
	components = {
		{
			class = "Button",
			sound = "button",
			onActivate = function(self)
				return self:isEnabled()
			end,
		},
	}
}
Then disableSelf will have the desired effect.
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
Illidan
Posts: 19
Joined: Sat Mar 12, 2016 3:23 pm
Location: Germany

Re: Grimrock 2 editor: Button disableSelf has no function!

Post by Illidan »

Great, works like a charm!
Thank you for the help and fast reply! :)
Post Reply