Hi, I have quite interesting problem. I am playing my custom dungeon - when I try to save the game (no matter if F5, crystal autosave or named save), the game crash with following error:
script_entity_277: 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 'quickSave'
[string "GameMode.lua"]: in function 'keyPressed'
etc...
any ideas what is going wrong ?
game crash when saving
Re: game crash when saving
It appears that you have some value of some non-local variable that is not allowed for save games
Finished Dungeons - complete mods to play
Re: game crash when saving
which in english means what ? :dKomag wrote:It appears that you have some value of some non-local variable that is not allowed for save games
saving was working without problem, but it began to crash at the end of dungeon. Could it have something to do with steam ?
Re: game crash when saving
In English, the custom dungeon is buggy.
Reminder: moderators (green names) don't work for almost human. | http://iki.fi/sol/ - My schtuphh..
Re: game crash when saving
Here's more details on what Komag was referring to: http://www.grimrock.net/modding/save-ga ... variables/Drakkan wrote:which in english means what ? :dKomag wrote:It appears that you have some value of some non-local variable that is not allowed for save games
saving was working without problem, but it began to crash at the end of dungeon. Could it have something to do with steam ?
In short, the probable cause is that you use variables in functions that are not local. Since the crash started happening towards the end of the dungeon, you probably can start looking for the issue in scripts that are triggered in those parts of the dungeon. But yeah, check out the documentation I linked to and if you need more help, ask again in this thread.

Steven Seagal of gaming industry
Re: game crash when saving
You could test again by trying to save all the time, and the first moment it crashes, just remember what you just recently did, and it must be involved with those scripts. Try to only use safe values for non-local variables, or try to change the script setup to just use a local (temporary) variable.
Finished Dungeons - complete mods to play
Re: game crash when saving
good, I have found the "invalid" script, however do not know what problem is, as the script itself is working right. Any tips ?
Code: Select all
function itemCheck(item)
-- checks for the item in champions hands
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
-- if found it is removed and the returnItem function is triggered
party:getChampion(champ):removeItem(slot)
print("item removed")
returnItem(item,champ)
end
end
end
end
end
function returnItem(item,champ)
-- checks backpacks for empty slot
for slot = 11,32 do
if slot < 32 then
if party:getChampion(champ):getItem(slot) == nil then
-- once found, the item is placed in a slot and the player is told where
print("item returned")
party:getChampion(champ):insertItem(slot,x)
hudPrint("Something strange in the air makes torches unusable in this area. Torch is put into "..party:getChampion(champ):getName().."'s bag." )
playSound("generic_spell")
break
end
else
-- if no slots are empty, the item is dropped
spawn(item,party.level,party.x,party.y,party.facing)
hudPrint("Your bags are full. The torch is dropped to the floor.")
break
end
end
end
function checkTorch()
itemCheck("torch")
end
Re: game crash when saving
your non-local variable x is storing the actual item from the player's hands, not just it's name or something else. either make x local or make it only store something like a string or a number
Finished Dungeons - complete mods to play