[Scripting] How to Disable a Lever

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
GoldenShadowGS
Posts: 168
Joined: Thu Oct 30, 2014 1:56 am

[Scripting] How to Disable a Lever

Post by GoldenShadowGS »

Here is how you can stop a lever from working and turn it back on at will.

Code: Select all

function disablelever()
	lever_1.clickable:disable()
	if lever_1.clickable:isEnabled() then
		print("Enabled")
	else 
		print("Disabled")
	end
end
Once disabled, you can not click on it again until you do this:

Code: Select all

function enablelever()
	lever_1.clickable:enable()
	if lever_1.clickable:isEnabled() then
		print("Enabled")
	else 
		print("Disabled")
	end
end
Post Reply