Jump to content

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

@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.

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...