Jump to content

DST to DS RoG - Custom Recipe Crash


Recommended Posts

Hello! I made two characters with custom recipe for DST and merged them into 1 mod. Everything is ok when I play on DST.

When it comes to DS RoG, I have a crash and I cannot load the mod, the game does not return to the main screen, but freezes, and there is no sound.

At first, I kept the recipe code as it was for DST. But the crash told me that AddRecipe had a Nil value. so...

I changed the recipe code to fit with RoG and put the code in the character prefabs (As see many mods doing this).

I believe my code is fine, but the crash tells me it's not. I can't find where and why it is crashing. The crash log looks like this :

Spoiler

...n/dont_starve/data/scripts/prefabs/player_common.lua:210: bad argument #1 to 'pairs' (table expected, got function)
LUA ERROR stack traceback:
        =[C] in function 'pairs'
        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/prefabs/player_common.lua(210,1)
        =(tail call) ?
        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/mainfunctions.lua(76,1)
        =(tail call) ?
        =[C] in function 'xpcall'
        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/mods.lua(42,1)
        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/mods.lua(303,1) in function 'RegisterPrefabs'
        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/gamelogic.lua(125,1) in function 'LoadAssets'
        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/gamelogic.lua(1361,1) in function 'DoResetAction'
        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/gamelogic.lua(1376,1) in function 'complete_callback'
    ...
        =[C] in function 'GetPersistentString'
        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/saveindex.lua(111,1) in function 'Load'
        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/gamelogic.lua(1397,1) in function 'callback'
        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/playerprofile.lua(602,1) in function 'Set'
        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/playerprofile.lua(486,1)
        =[C] in function 'GetPersistentString'
        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/playerprofile.lua(484,1) in function 'Load'
        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/gamelogic.lua(1396,1) in main chunk
        =[C] in function 'require'
        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/mainfunctions.lua(657,1)   

The recipe in the prefabs looks like this :

Spoiler

local sort_key = 500

local hadabratab = {str = "Nature Wisdom", sort_key, icon_atlas = "images/recipe_tab/hadabratab.xml", icon = "hadabratab.tex"}
inst.components.builder:AddRecipeTab(hadabratab)

local hungerpotion_recipe = Recipe("hungerpotion", {Ingredient("carrot", 4), Ingredient("pumpkin", 1)}, hadabratab, TECH.NONE , nil , nil, nil, nil, "hadabra" , "images/inventoryimages/hungerpotion.xml")

 

I would really appreciate if someone know what " bad argument #1 to 'pairs' " means in that case. I searched into the luas but can't understand where it leads so far...

Thank you for helping me out!

D4rkh0bb1T

Link to comment
Share on other sites

@D4rkh0bb1T this crash is caused by an invalid starter inventory. heck the last line of your character file, the last (fourth) thing in the parantheses should be your starter inventory, but is a function.

My guess is you placed the custom function (usually called "fn") as fourth parameter, when it should be third.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...