Jump to content

Mod dont work and I dont know why....


Recommended Posts

I want to use a Dst character, rin, on Hamlet. So I followed this guide(not the character part as the original mod does not have it), but the game froze when I enabled this mod. Need help!

 

rin.zip

rin.tex

rin.xml

changelog.txt

rin.tex

rin.xml

names_rin.tex

names_rin.xml

rin.tex

rin.xml

rin.tex

rin.xml

rin_silho.tex

rin_silho.xml

modicon.tex

modicon.xml

modinfo.lua

modmain.lua

rin.lua

speech_rin.lua

Link to comment
Share on other sites

The title sounds like the title AND the first two lines of a pop/rock song for the young modding community xD

That's a lot of files, but what I really need is your client and server logs. See the newcomer post under "Debugging" if you don't know where the logs are. If you are new to modding, I also highly advise you to read the newcomer post. I would have saved maybe 3 months of my life, if I just had those bits of information when I started modding :) Especially if you employ the notes on searching the forums properly.

Link to comment
Share on other sites

These lines tell you the problem

Spoiler

...n/dont_starve/data/scripts/prefabs/player_common.lua:358: 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(358,1)
        =(tail call) ?
        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/mainfunctions.lua(84,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(136,1) in function 'LoadAssets'
        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/gamelogic.lua(1492,1) in function 'MainScreenFlow'
        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/gamelogic.lua(1586,1) in function 'DoResetAction'
	...
        =[C] in function 'GetPersistentString'
        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/saveindex.lua(103,1) in function 'Load'
        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/gamelogic.lua(1622,1) in function 'callback'
        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/playerprofile.lua(737,1) in function 'Set'
        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/playerprofile.lua(621,1)
        =[C] in function 'GetPersistentString'
        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/playerprofile.lua(619,1) in function 'Load'
        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/gamelogic.lua(1621,1) in main chunk
        =[C] in function 'require'
        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/mainfunctions.lua(746,1)	
[00:01:17]: scripts/mods.lua(253,1) Disabling rin (Rin Kaenbyou) because it had an error.	
[00:01:17]: scripts/frontend.lua(773,1) SCRIPT ERROR! Showing error screen	
[00:01:17]: scripts/mods.lua(302,1) Mod: rin (Rin Kaenbyou)	  Registering prefab file: prefabs/rin_none	
[00:01:17]: scripts/mods.lua(44,1) error calling LoadPrefabFile in mod rin (Rin Kaenbyou): 
...ps/common/dont_starve/data/scripts/mainfunctions.lua:81: Error loading file prefabs/rin_none

	no file '../mods/rin/scripts/prefabs/rin_none.lua' (checked with custom loader)
	no file 'scripts/prefabs/rin_none.lua' (checked with custom loader)
	no file 'scriptlibs/prefabs/rin_none.lua' (checked with custom loader)
	no file 'scripts/prefabs/rin_none.lua' (checked with custom loader)
LUA ERROR stack traceback:
        =[C] in function 'assert'
        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/mainfunctions.lua(81,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(136,1) in function 'LoadAssets'
        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/gamelogic.lua(1492,1) in function 'MainScreenFlow'
        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/gamelogic.lua(1586,1) in function 'DoResetAction'
        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/gamelogic.lua(1600,1) in function 'complete_callback'
        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/upsell.lua(27,1) in function 'UpdateGamePurchasedState'
	...
        =[C] in function 'GetPersistentString'
        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/saveindex.lua(103,1) in function 'Load'
        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/gamelogic.lua(1622,1) in function 'callback'
        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/playerprofile.lua(737,1) in function 'Set'
        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/playerprofile.lua(621,1)
        =[C] in function 'GetPersistentString'
        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/playerprofile.lua(619,1) in function 'Load'
        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/gamelogic.lua(1621,1) in main chunk
        =[C] in function 'require'
        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/mainfunctions.lua(746,1)	

 

"But those functions have nothing to do with my mod!"

That's sort of true, except these functions are using data that your mod provides. Let's see what line 358 of player_common.lua does.

if starting_inventory then
	for k,v in pairs(starting_inventory) do -- This is line 358
		table.insert(prefabs, v)
	end
end

It's trying to start a for-loop on the pairs in the variable starting_inventory, and is giving you the following error statement:

bad argument #1 to 'pairs' (table expected, got function)

Argument #1 to 'pairs' is the starting_inventory, where it expected to get a table, but it received a function. You're passing a function as the starting_inventory instead of a table.

So, where is this happening? At the bottom of your character's LUA file, the function MakePlayerCharacter is called.

In DS, its parameter list looks like this:

MakePlayerCharacter(name, customprefabs, customassets, customfn, starting_inventory)

and you are calling it like this:

MakePlayerCharacter("rin", prefabs, assets, common_postinit, master_postinit, start_inv)

So, you are passing it an extra parameter, in this case it would be one of the postinits. The reason for the confusion, is that in DST they have split the customfn parameter up into common_postinit and master_postinit, so it looks like this, which matches your parameter list:

MakePlayerCharacter(name, customprefabs, customassets, common_postinit, master_postinit, starting_inventory)

What you have to do to fix this, is move any code from your common_postinit into your master_postinit, and remove the common_postinit function AND remove common_postinit from your parameter list when calling MakePlayerCharacter.

Link to comment
Share on other sites

Yeah,I just found it out myself yesterday. What I do is to move them to local fn = function(inst). Sadly, it's not the only reason that makes my mod crash. I tried to compare it to another DS mode Wendi (without any unique ability except run faster) and make my code looks much more similar to Wendi's. I even try to just change all Wendi in code to Rin and replace all other files to Rin's files but it seems like it's not the way that DS work.

BTW, will it be easier to just replace the tex,xml and zip files with Rin's files? The only thing I need from this DST mod is Rin's cuteness.

More BTW, this experience will be a great example if I try to explain why shouldn't I change my program to computer science from psychology.

More, more BTW, about that weird tilted. English is not my first language, so it is the only way I know to express my idea out. 

codes and log

rin.rar

Link to comment
Share on other sites

Spoiler

...dont_starve/data/../mods/rin/scripts/prefabs/rin.lua:167: variable 'start_inv' is not declared
LUA ERROR stack traceback:
        =[C] in function 'error'
        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/strict.lua(23,1)
        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/../mods/rin/scripts/prefabs/rin.lua(167,1) in function 'fn'
        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/mainfunctions.lua(84,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(136,1) in function 'LoadAssets'
        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/gamelogic.lua(1497,1) in function 'MainScreenFlow'
        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/gamelogic.lua(1591,1) in function 'DoResetAction'
	...
        =[C] in function 'GetPersistentString'
        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/saveindex.lua(103,1) in function 'Load'
        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/gamelogic.lua(1627,1) in function 'callback'
        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/playerprofile.lua(737,1) in function 'Set'
        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/playerprofile.lua(621,1)
        =[C] in function 'GetPersistentString'
        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/playerprofile.lua(619,1) in function 'Load'
        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/gamelogic.lua(1626,1) in main chunk
        =[C] in function 'require'
        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/mainfunctions.lua(746,1)	
[00:00:18]: scripts/mods.lua(253,1) Disabling rin (Rin Kaenbyou) because it had an error.	

 

It says that on line 167, you are trying to use the variable 'start_inv', but it is not declared, as in not available.

You deleted the 'start_inv' variable in your character prefab LUA code.

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