Need help fixing a crash
Posted: Thu Feb 06, 2014 12:37 am
So I have three scripts here that all work fine on there own, the problem I have is if the three are all used at some point it causes the game to crash when trying to save, otherwise everything works fine
This first script just equalizes the levels of the party to the first party member, since the other members are found later in the dungeon
This script is called on by the first script, its in an SE called OrdinalScript.
This last one checks if the party has a certain item on and opens a door, all three work fine, but if both the first and third script are run it causes a crash when saving "unable to serialize vainz against metatable"
Any ideas on how to fix this?
Code: Select all
function LvlComp()
if (party:getChampion(2):getEnabled()) then
local C1 = OrdinalScript.getChampionWithOrdinal(1);
local C2 = OrdinalScript.getChampionWithOrdinal(2);
while (C2:getLevel() < C1:getLevel()) do
C2:levelUp();
end
end
end
function Lvl3()
if (party:getChampion(3):getEnabled()) then
local C1 = OrdinalScript.getChampionWithOrdinal(1);
local C2 = OrdinalScript.getChampionWithOrdinal(3);
while (C2:getLevel() < C1:getLevel()) do
C2:levelUp();
end
end
end
function lvl4()
if (party:getChampion(4):getEnabled()) then
local C1 = OrdinalScript.getChampionWithOrdinal(1);
local C2 = OrdinalScript.getChampionWithOrdinal(4);
while (C2:getLevel() < C1:getLevel()) do
C2:levelUp();
end
end
endCode: Select all
function getChampionWithOrdinal(ordinal)
for i=1,4 do
if ( party:getChampion(i):getOrdinal() == ordinal )
then return party:getChampion(i);
end
end
return nil;
endCode: Select all
function VainCheck(item)
for champ = 1,4 do
for slot = 1,8 do
vainz = party:getChampion(champ):getItem(slot)
if vainz ~= nil then
if vainz.name == item then
dm_irondoor_1:open()
timer_v:destroy()
end
end
end
end
end
function checkShirt()
VainCheck("Dandy_shirt")
end
function checkPants()
VainCheck("Dandy_pants")
endAny ideas on how to fix this?