I'm using a pit immunity script and it crashes the (exported) game when I save it. I started out by using the pit immunity script from the useful scripts repository but it didn't work for me so I changed it a bit. The timer was the problem and I added a pressure plate to stop the script instead.
function immunityRevoke()
for i = 1,4 do
pitImmunity = party:getChampion(i)
pitImmunity:setEnabled(true)
end
end
The error message:
SpoilerShow
script_entity_2: cannot serialize table 'pitImmunity' 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 "SaveGameMenu.lua"]: in function 'update'
[string "GameMode.lua"]: in function 'update'
[string "Grimrock.lua"]: in function 'display'
[string "Grimrock.lua"]: in main chunk
I am not sure about this, as I havent run across the script before. However, the pitImmunity command you are using is not built into LoG, which leads me to surmise that it is part of a "Framework" you will need to install to get the extra commands. Go back where you found the script and see if it is part of a larger framework, then read on how to install it.
edit: See Komag below, it usually saves a lot of trouble.
Last edited by msyblade on Fri Apr 26, 2013 3:38 pm, edited 1 time in total.
Currently conspiring with many modders on the "Legends of the Northern Realms"project.
"You have been captured by a psychopathic diety who needs a new plaything to torture." Hotel Hades
function tempImmunity()
for i = 1,4 do
local pitImmunity = party:getChampion(i)
pitImmunity:setEnabled(false)
end
end
function immunityRevoke()
for i = 1,4 do
local pitImmunity = party:getChampion(i)
pitImmunity:setEnabled(true)
end
end
But if I were you I would simply leave off the pointless variable altogether:
function tempImmunity()
for i = 1,4 do
party:getChampion(i):setEnabled(false)
end
end
function immunityRevoke()
for i = 1,4 do
party:getChampion(i):setEnabled(true)
end
end
(I haven't tested it, and it's been a while, so maybe I'm mistaken about something)
Thank you Komag. That script works. In a brand new dungeon. However, when I put it into my work in progress the editor crashes to the point where I have to reboot my pc. In other words, I've got gremlins in my dungeon and they are messing up the script somehow. ... back to the drawing board ...
they are quite simple straightforward functions - I can't imagine what could cause a bad hard crash like that. Have you tried renaming the functions? What about adding a very fast timer at the bottom to have a tiny delay between the plate and the function?