Page 1 of 1

Please Help...

Posted: Sat Sep 15, 2012 5:05 am
by monkmeh
Hello, I'm a huge Grimrock fan and really enjoying the editor so far. However, I've run into some trouble with the lua scripts while trying to add things in the editor (I know I know there have been a hundred of these topics). Here is my problem...I want to get a door on level 2 to be opened when two plates are being pressed down with items on level 3. Eventually, I would like for these to be specific items that have to trigger the plates if that is possible. I appreciate any help that I can get, as I am totally new to modding/coding. Here is my lua code.

--plate level toggle
function platedown()
if plate1:getPlateState() == "activated" and
plate2:getPlateState() == "activated" then
door1:open()
else
door1:close()
end
end

T

Re: Please Help...

Posted: Sat Sep 15, 2012 7:07 am
by petri
There is no getPlateState(). See isDown() and isUp() in scripting reference.

Re: Please Help...

Posted: Sat Sep 15, 2012 11:39 am
by Komag
I believe it is possible to do what you want. There is a way to detect which item is in the square, and to control things on different levels. There are other threads which explain it all in detail

Re: Please Help...

Posted: Sat Sep 15, 2012 5:39 pm
by monkmeh
Alright, thanks for the help! I'll definitely check those out.

Re: Please Help...

Posted: Sat Sep 15, 2012 6:06 pm
by Shroom
function platedown()
if plate1:getPlateState() == "activated" and
plate2:getPlateState() == "activated" then
door1:open()
else
door1:close()
end
end
To use your code, just replace the methods

Code: Select all

function platedown()
    if plate1:isDown() and plate2:isDown() then
        door1:open()
    else
        door1:close()
    end
end
Add a connector to each plate to call the lua entity with the code in to check