Scripting Crashes, VERY CONFUSED
Posted: Fri Oct 24, 2014 6:08 am
This is in reference to the Grimrock 2 editor.
So I'm very new to the Dungeon Editor, and I also have very little scripting experience. That said, I am a logical person and I can follow instructions well. I've been trying to get simple scripts to fire off when pulling levers/inserting items onto alcoves to open doors. Nothing complicated. I keep having problems with calling ID names it seems. I've tried to recreate the scripts below; while everything is named and connected properly, I keep getting "attempt to call method(whatever ID name) a nil value x. Am I missing something completely obvious?
---
function checkLevers()
if combination_lever_1.lever:isActivated() and not combination_lever_2.lever:isActivated() and combination_lever_3.lever:isActivated() then
combination_door.door:open()
else
combination_door.door:close()
end
end
---
and this:
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
end
So I'm very new to the Dungeon Editor, and I also have very little scripting experience. That said, I am a logical person and I can follow instructions well. I've been trying to get simple scripts to fire off when pulling levers/inserting items onto alcoves to open doors. Nothing complicated. I keep having problems with calling ID names it seems. I've tried to recreate the scripts below; while everything is named and connected properly, I keep getting "attempt to call method(whatever ID name) a nil value x. Am I missing something completely obvious?
---
function checkLevers()
if combination_lever_1.lever:isActivated() and not combination_lever_2.lever:isActivated() and combination_lever_3.lever:isActivated() then
combination_door.door:open()
else
combination_door.door:close()
end
end
---
and this:
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
end