My code/error messages are as follows:
onEquipItem hook [ideally I could find what's wrong with this and just use it]
Code: Select all
onEquipItem = function()
script_entity_7.itemCheck()
return true
end
--onEquipItem = function(champion, slot)
-- for champ = 1,4 do
-- for slot = 7,8 do
-- party:getChampion(ch):setCondition("poison", 30)
-- return true
-- end
-- end
--end
--this commented-out onEquipItem section makes the Dungeon Editor crash when the item is in-hand (with no subsequent error message)
Code: Select all
function itemCheck()
-- supposing the item causing the crash is actually named "item"
for champ = 1,4 do
for slot = 7,8 do
x = party:getChampion(champ):getItem(slot)
if x ~= nil then
if x.name == "item" then
party:getChampion(champ):setCondition("poison", 30)
end
end
end
end
end
Code: Select all
script_entity_7: cannot serialize table 'x' with metatable stack traceback:
[C]: in function 'error'
[string "ScriptEntity.lua"]: in function 'saveValue'
[string "ScriptEntity.lua"]: in function 'saveState'
[string "GameMode.lua"]: in function 'saveGame'
[string "GameMode.lua"]: in function 'autoSave'
[string "Crystal.lua"]: in function 'onClick'
[string "GameMode.lua"]: in function 'mousePressed'
[string "GameMode.lua"]: in function 'update'
[string "Grimrock.lua"]: in function 'display'
[string "Grimrock.lua"]: in main chunk