Jump to content

Recommended Posts

Okay so I've spent 30 minutes testing as many different combinations as I possibly can think of, but I can't find an answer or solution. If anyone can help me out that'd be greatly appreciated.

 

Error

00:00:20]: [string "scripts/dumper.lua"]:112: Cannot dump userdata (Transform (201C4DE8) - unknown)
LUA ERROR stack traceback:
=[C]:-1 in (global) error © <-1--1>
scripts/dumper.lua:112 in () ? (Lua) <98-113>
   value = Transform (201C4DE8)
   var = nil
   i = 8
=(tail call):-1 in ()  (tail) <-1--1>
scripts/dumper.lua:151 in () ? (Lua) <141-159>
   value = 113733 - soda_treasure(LIMBO) (valid:true)
   numidx = 1
   key = Transform
   val = Transform (201C4DE8)
=(tail call):-1 in ()  (tail) <-1--1>
scripts/dumper.lua:132 in () ? (Lua) <127-136>
   t = table: 0CB9D738
   key = 113733 - soda_treasure(LIMBO) (valid:true)
   s = nil
scripts/dumper.lua:149 in () ? (Lua) <141-159>
   value = table: 144EB6C8
   numidx = 1
   key = 113733 - soda_treasure(LIMBO) (valid:true)
   val = table: 0CB9D670
=(tail call):-1 in ()  (tail) <-1--1>
scripts/dumper.lua:151 in () ? (Lua) <141-159>
   value = table: 0CB9D4E0
   numidx = 1
   key = soda
   val = table: 144EB6C8
=(tail call):-1 in ()  (tail) <-1--1>
scripts/dumper.lua:151 in () ? (Lua) <141-159>
   value = table: 0CB9D3A0
   numidx = 1
   key = data
   val = table: 0CB9D4E0
=(tail call):-1 in ()  (tail) <-1--1>
scripts/dumper.lua:225 in (global) DataDumper (Lua) <77-245>
   value = table: 0CB9D3A0
   varname = return 
   fastmode = true
   ident = nil
   defined = table: 0CB9D710
   dumplua = function - scripts/dumper.lua:214
   string_format = function - =[C]:-1
   type = function - =[C]:-1
   string_dump = function - =[C]:-1
   string_rep = function - =[C]:-1
   tostring = function - =[C]:-1
   pairs = function - =[C]:-1
   table_concat = function - =[C]:-1
   keycache = table: 0CB9D738
   strvalcache = table: 0CB9D760
   out = table: 0CB9D788
   closure_cnt = 0
   fcts = table: 0CB9D828
   test_defined = function - scripts/dumper.lua:116
   make_key = function - scripts/dumper.lua:127
scripts/networking.lua:94 in (global) SerializeUserSession (Lua) <87-99>
   player = 113290 - naomi (valid:true)
   isnewspawn = nil
   is_local_player = true
   playerinfo = table: 0CB9D3A0
   new_refs = nil
scripts/mainfunctions.lua:599 in (global) SaveGame (Lua) <512-638>
   savename = survival_5
   cb = function - scripts/saveindex.lua:622
   callback = function - scripts/mainfunctions.lua:518
   save = table: 227C9430
   nument = 12069
   saved_ents = table: 227C9480
   references = table: 227C94D0
   new_refs = nil
   ground = 100017 - forest (valid:true)
   i = 1
   player = 113290 - naomi (valid:true)
scripts/saveindex.lua:626 in (method) SaveCurrent (Lua) <564-627>
   self =
      data = table: 0D752C18
      current_slot = 5
   onsavedcb = function - scripts/mainfunctions.lua:964
   check_snapshot = nil
   direction = nil
   cave_num = nil
   ground = 100017 - forest (valid:true)
   level_number = 1
   day_number = 1
   current_mode = survival
   data = table: 0D753D20
   dlc = table: 0D753C08
   snapshots = table: 0D754040
   take_snapshot = false
   onsavedindex = function - scripts/saveindex.lua:612
   onsavedgame = function - scripts/saveindex.lua:622
scripts/mainfunctions.lua:981 in (local) cb (Lua) <973-986>
scripts/frontend.lua:447 in (method) DoFadingUpdate (Lua) <411-451>
   self =
      topblackoverlay = Image - images/global.xml:square.tex
      fade_title_out = false
      overlayroot = overlayroot
      save_indicator_time_left = 0
      fade_title_time = 0
      helptextbg = Image - images/global.xml:square.tex
      helptext = HelpText
      subtitle = Text - 
      updating_widgets_alt = table: 14BA0468
      spinner_repeat_time = -1
      title = Text - 
      scroll_repeat_time = -1
      topFadeHidden = false
      gameinterface = 100012 -  (valid:true)
      updating_widgets = table: 1528F318
      lastx = 841
      total_fade_time = 1
      lasty = 378
      autosave_enabled = true
      fade_time = 1.0000043418258
      blackoverlay = Image - images/global.xml:square.tex
      screenstack = table: 0D753E10
      num_pending_saves = 0
      save_indicator_fade_time = 0
      saving_indicator = UIAnim
      consoletext = Text - CONSOLE TEXT
      alpha = 1
      tr

[00:00:20]: SCRIPT ERROR! Showing error screen

 

Broken Code:

local function OnSave(inst, data)    if inst.abigails ~= nil then        local abigails = inst.abigails        for k, v in pairs(inst.abigails) do            if inst.abigails[k] ~= nil then                abigails[k] = inst.abigails[k]:GetSaveRecord()            end        end        data.abigails = abigails    endend 

 

Working Code:

local function OnSave(inst, data)    if inst.abigail ~= nil then        data.abigail = inst.abigail:GetSaveRecord()    endend 

 

Basically I'm trying to create a way to possess multiple Abigail's at the same time. Everything aside from saving is working properly, which has become a pain in the rear.

 

 

Edit:

I resolved the issue I was having through a different method, however, this is still an issue that probably should be looked into to see if we can find a resolution because I personally see no reason why this method should not work.

Edited by Kzisor
  • Developer

@Kzisor

 

It seems to me that the fix you have would not directly be responsible for it to work.

It seems the one that crashes tries to save a record with a Transform as one of the fields, instead of storing x, y and z. The Transform is a c-side component and they can not be serialized through the save system.

@DarkXero, yes, it is correctly referencing a prefab. I'm not inclined to share the files because I am working in collaboration with another whom has not given me expressive permission to share with anyone. I can indeed verify that the information is getting set properly because the following code works:

 

local function OnDespawn(inst)    if inst.abigails ~= nil then        for k, v in pairs(inst.abigails) do            v.components.health:SetInvincible(true)            v:PushEvent("death")            --in case the state graph got interrupted somehow, just force            --removal after the dissipate animation should've finished            v:DoTaskInTime(25 * FRAMES, v.Remove)        end    endend 

 

@bizziboi, yes PeterA mentioned that it might be in the userdata itself and that I should try debugging the userdata that it's receiving to ensure that it's getting the proper data. I will definitely be doing more tests to see if I can get it corrected.

@DarkXero, I already tried that, let me get you the error message from it.

 

[string "../mods/Wendy/scripts/prefabs/wendy.lua"]:36: bad argument #2 to 'insert' (number expected, got table)

 

FWIW: Line 36 is table.insert

 

Yes, this is using your code exactly.

Edited by Kzisor

Kzisor, I think the issue lied here:

local abigails = inst.abigailsdata.abigails = abigails

But maybe you can try:

local function OnSave(inst, data)   if inst.abigails then      data.abigails = {}      for k, v in pairs(inst.abigails) do         data.abigails[k] = v:GetSaveRecord()      end   endend

to verify?

 

Also, what would be the keys for identifying the different abigails in inst.abigails? If there are none, then pairs behaves like ipairs or what keys does it use?

 

Edit: nevermind

Edited by DarkXero

@DarkXero, because whenever I save and open the same world; Abigail is a new spawn not spawned from the save file. If it's spawned from the save file you won't see her spawn she will be there by the time the world loads. Otherwise you see her spawn; mainly because I have her set to spawn 5 seconds after I load into the game. 

 

I think the issue lies now in the fact that inst.abigails is now empty. I think I've changed the code so much that the problem which I was having might not be able to be reproduced with the current iteration of code. The person whom I am collaborating with doesn't care about this particular issue at hand because we got a better fix for it with what their wanting. I want it fixed because I want to use this particular style for another mod (Twin Powers).

  • Developer

So (part of) the problem was that inst.abigails was a table of entity->entity, so the save record had entities as its keys. Since the serialization will try to serialize the keys it would serialize the entity and thus try to serialize the Transform, which it couldn't.

  • Developer
table.insert(data.abigails, v:GetSaveRecord())

 

And as man-machine Vito spotted, the above line errors because GetSaveRecord returns two parameters, thus calling the table.insert that takes 3 parameters, which indeed expects a number as its second parameter. 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...