[Solved] Way to test if objects are active?

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
DrMilesManners
Posts: 5
Joined: Mon Oct 27, 2014 6:55 am

[Solved] Way to test if objects are active?

Post by DrMilesManners »

Hello, I'm trying to make a riddle that is based off of certain pressure plates being active and a counter being at a certain value and when solved opens a door. First of all does anyone know what kind of object a pressure plate is? Like pressureplate1.pressure_plate:isActive() or pressureplate1.plate:isActive()? Secondly, is the way to test for objects being active done through the isActive() function or is there another function name?

At this point, I am using this code (X, Y, and Z being numerical values):

Code: Select all

function earthsequence()
	print(earth_counter.counter:getValue())
	if earth_counter.counter:getValue() == Z and answer_X.plate:isActive() and answer_Y.plate:isActive()
	then earth_door.door:open()
	else
	end
end
Last edited by DrMilesManners on Wed Oct 29, 2014 10:57 pm, edited 1 time in total.
User avatar
sps999
Posts: 44
Joined: Sun Oct 26, 2014 11:16 pm

Re: Way to test if objects are active? [Lua scripting help]

Post by sps999 »

I believe what you are looking for is:

Code: Select all

pressure_plate_1.floortrigger:isActivated()
There is a very nice topic that I don't believe has received enough attention over here:
viewtopic.php?f=22&t=7882

That thread contains a list of most of the names you'll need to reference, and is what's holding me over until AH releases the references themselves.
User avatar
DrMilesManners
Posts: 5
Joined: Mon Oct 27, 2014 6:55 am

Re: Way to test if objects are active? [Lua scripting help]

Post by DrMilesManners »

So it's a "FloorTriggeredComponent" class and an "isActivated" function according to the post?
Edit:
(I'm asking because I might try adding custom floor components in the future, like a custom floor trap.)
User avatar
DrMilesManners
Posts: 5
Joined: Mon Oct 27, 2014 6:55 am

Re: Way to test if objects are active? [Lua scripting help]

Post by DrMilesManners »

Ok finally tested the code out and it works! Thanks for the help! Oh and that guy who wrote that post about the functions needs a cookie haha.
Post Reply