Brand new to Lua and modding for Legend of Grimrock.
My question is a pretty simple one but the solution may not be as straightforward.
How do I create an 'item on alcove puzzle' where putting the correct item on an alcove opens a door and removing the item closes the door.
I've read the modding guide and the solution they provide is to use this code:
Code: Select all
function itemPuzzle()
-- iterate through all contained items on alcove, checking for a matching name
for i in itemPuzzleAlcove:containedItems() do
if i.name == "pitroot_bread" then
playSound("level_up")
break
end
end
endCode: Select all
(any, *doorname*, toggle)The problem with this approach is that while the correct item triggers the sound effect and activates the connector to open the door, any other item I use also opens the door. The only difference is that the incorrect item doesn't trigger the sound effect. Obviously this shouldn't happen.
How would I alter the code/change the connector so that only the correct item activates the connector? Any other item placed on the Alcove should do nothing.
Thanks in advance.

