Jump to content

Error loading file prefabs?


Recommended Posts

Hello!

I'm trying to change the name of my character in a mod, updating all of the old references with the new name.  I think I've done it all correctly, but I'm getting an error..  I've included the error report.

The animation files were all renamed and regenerated, as were the image files, and the character's nameplate file was generated and then the text inside fixed.
The sound files have not been regenerated yet, so that code still has the old references.

It almost seems like the game can't find the character's prefab file, but I have no idea what's going on for sure..

[00:00:05]: Mod: workshop-2238207705 (The Wild Child  -Ver. 1.3.4.7)	Registering prefabs	
[00:00:05]: Mod: workshop-2238207705 (The Wild Child  -Ver. 1.3.4.7)	  Registering prefab file: prefabs/wildchild	
[00:00:05]: error calling LoadPrefabFile in mod workshop-2238207705 (The Wild Child  -Ver. 1.3.4.7): 
[string "scripts/mainfunctions.lua"]:157: Error loading file prefabs/wildchild

	no file '../mods/workshop-2238207705/scripts/prefabs/wildchild.lua' (checked with custom loader)
	no file 'scripts/prefabs/wildchild.lua' (checked with custom loader)
	no file 'scriptlibs/prefabs/wildchild.lua' (checked with custom loader)
LUA ERROR stack traceback:
        =[C] in function 'assert'
        scripts/mainfunctions.lua(157,1)
        =(tail call) ?
        =[C] in function 'xpcall'
        scripts/mods.lua(167,1)
        scripts/mods.lua(643,1) in function 'RegisterPrefabs'
        scripts/gamelogic.lua(236,1) in function 'LoadAssets'
        scripts/gamelogic.lua(1116,1) in function 'DoResetAction'
        scripts/gamelogic.lua(1135,1) in function 'complete_callback'
        scripts/upsell.lua(13,1) in function 'UpdateGamePurchasedState'
        scripts/gamelogic.lua(1159,1) in function 'callback'
	...
        =[C] in function 'GetPersistentString'
        scripts/saveindex.lua(285,1) in function 'Load'
        scripts/gamelogic.lua(1188,1) in function 'callback'
        scripts/playerprofile.lua(1206,1) in function 'Set'
        scripts/playerprofile.lua(1057,1)
        =[C] in function 'GetPersistentString'
        scripts/playerprofile.lua(1055,1) in function 'Load'
        scripts/gamelogic.lua(1187,1) in main chunk
        =[C] in function 'require'
        scripts/mainfunctions.lua(1114,1)	
[00:00:05]: Disabling workshop-2238207705 (The Wild Child  -Ver. 1.3.4.7) because it had an error.	
[00:00:05]: [string "scripts/mainfunctions.lua"]:157: Error loading file prefabs/wildchild

	no file '../mods/workshop-2238207705/scripts/prefabs/wildchild.lua' (checked with custom loader)
	no file 'scripts/prefabs/wildchild.lua' (checked with custom loader)
	no file 'scriptlibs/prefabs/wildchild.lua' (checked with custom loader)
LUA ERROR stack traceback:
        =[C] in function 'assert'
        scripts/mainfunctions.lua(157,1)
        =(tail call) ?
        =[C] in function 'xpcall'
        scripts/mods.lua(167,1)
        scripts/mods.lua(643,1) in function 'RegisterPrefabs'
        scripts/gamelogic.lua(236,1) in function 'LoadAssets'
        scripts/gamelogic.lua(1116,1) in function 'DoResetAction'
        scripts/gamelogic.lua(1135,1) in function 'complete_callback'
        scripts/upsell.lua(13,1) in function 'UpdateGamePurchasedState'
        scripts/gamelogic.lua(1159,1) in function 'callback'
	...
        =[C] in function 'GetPersistentString'
        scripts/saveindex.lua(285,1) in function 'Load'
        scripts/gamelogic.lua(1188,1) in function 'callback'
        scripts/playerprofile.lua(1206,1) in function 'Set'
        scripts/playerprofile.lua(1057,1)
        =[C] in function 'GetPersistentString'
        scripts/playerprofile.lua(1055,1) in function 'Load'
        scripts/gamelogic.lua(1187,1) in main chunk
        =[C] in function 'require'
        scripts/mainfunctions.lua(1114,1)
[00:00:05]: [string "scripts/mainfunctions.lua"]:157: Error loading file prefabs/wildchild

	no file '../mods/workshop-2238207705/scripts/prefabs/wildchild.lua' (checked with custom loader)
	no file 'scripts/prefabs/wildchild.lua' (checked with custom loader)
	no file 'scriptlibs/prefabs/wildchild.lua' (checked with custom loader)
LUA ERROR stack traceback:
        =[C] in function 'assert'
        scripts/mainfunctions.lua(157,1)
        =(tail call) ?
        =[C] in function 'xpcall'
        scripts/mods.lua(167,1)
        scripts/mods.lua(643,1) in function 'RegisterPrefabs'
        scripts/gamelogic.lua(236,1) in function 'LoadAssets'
        scripts/gamelogic.lua(1116,1) in function 'DoResetAction'
        scripts/gamelogic.lua(1135,1) in function 'complete_callback'
        scripts/upsell.lua(13,1) in function 'UpdateGamePurchasedState'
        scripts/gamelogic.lua(1159,1) in function 'callback'
	...
        =[C] in function 'GetPersistentString'
        scripts/saveindex.lua(285,1) in function 'Load'
        scripts/gamelogic.lua(1188,1) in function 'callback'
        scripts/playerprofile.lua(1206,1) in function 'Set'
        scripts/playerprofile.lua(1057,1)
        =[C] in function 'GetPersistentString'
        scripts/playerprofile.lua(1055,1) in function 'Load'
        scripts/gamelogic.lua(1187,1) in main chunk
        =[C] in function 'require'
        scripts/mainfunctions.lua(1114,1)	
[00:00:05]: Mod: workshop-2238207705 (The Wild Child  -Ver. 1.3.4.7)	  Registering prefab file: prefabs/wildchild_none	
[00:00:05]: error calling LoadPrefabFile in mod workshop-2238207705 (The Wild Child  -Ver. 1.3.4.7): 
[string "scripts/mainfunctions.lua"]:157: Error loading file prefabs/wildchild_none

	no file '../mods/workshop-2238207705/scripts/prefabs/wildchild_none.lua' (checked with custom loader)
	no file 'scripts/prefabs/wildchild_none.lua' (checked with custom loader)
	no file 'scriptlibs/prefabs/wildchild_none.lua' (checked with custom loader)
LUA ERROR stack traceback:
        =[C] in function 'assert'
        scripts/mainfunctions.lua(157,1)
        =(tail call) ?
        =[C] in function 'xpcall'
        scripts/mods.lua(167,1)
        scripts/mods.lua(643,1) in function 'RegisterPrefabs'
        scripts/gamelogic.lua(236,1) in function 'LoadAssets'
        scripts/gamelogic.lua(1116,1) in function 'DoResetAction'
        scripts/gamelogic.lua(1135,1) in function 'complete_callback'
        scripts/upsell.lua(13,1) in function 'UpdateGamePurchasedState'
        scripts/gamelogic.lua(1159,1) in function 'callback'
	...
        =[C] in function 'GetPersistentString'
        scripts/saveindex.lua(285,1) in function 'Load'
        scripts/gamelogic.lua(1188,1) in function 'callback'
        scripts/playerprofile.lua(1206,1) in function 'Set'
        scripts/playerprofile.lua(1057,1)
        =[C] in function 'GetPersistentString'
        scripts/playerprofile.lua(1055,1) in function 'Load'
        scripts/gamelogic.lua(1187,1) in main chunk
        =[C] in function 'require'
        scripts/mainfunctions.lua(1114,1)	
[00:00:05]: Disabling workshop-2238207705 (The Wild Child  -Ver. 1.3.4.7) because it had an error.

 

server_log_2021-05-02-11-28-10.txt

Link to comment
Share on other sites

Would you be able to upload what you have done here?  The one on the workshop doesn't seem to have your changes you made and figuring out where the problem lies is going to be (most likely) a missed reference somewhere in the files.

 

I also noticed a chunk of if/then/else block near the start which can be shortened down a bit:

Spoiler

if GetModConfigData("amulaterate") == 1 then  --10%.
	d = "10%"
elseif GetModConfigData("amulaterate") == 2 then  --20%.
	d = "20%"
elseif GetModConfigData("amulaterate") == 3 then  --30%.
	d = "30%"
elseif GetModConfigData("amulaterate") == 4 then  --40%.
	d = "40%"
elseif GetModConfigData("amulaterate") == 5 then  --50%.
	d = "50%"
elseif GetModConfigData("amulaterate") == 6 then  --60%.
	d = "60%"
elseif GetModConfigData("amulaterate") == 7 then  --70%.
	d = "70%"
elseif GetModConfigData("amulaterate") == 8 then  --80%.
	d = "80%"
else
	d = "Error%"
end

 

To:

d = string.format("%d0%%", GetModConfigData("amulaterate"))

If the mod config bounds are out of range, then the user itself changed the value to weird values.

As it stands you're missing the 90% case as per the modinfo letting it get to 9, and the generic function "just works".

 

Likewise:

Spoiler

	if GetModConfigData("amulaterate") == 1 then  --10%
		inst.components.fueled.bonusmult = 0.2
	elseif GetModConfigData("amulaterate") == 2 then  --20%
		inst.components.fueled.bonusmult = 0.4
	elseif GetModConfigData("amulaterate") == 3 then  --30%
		inst.components.fueled.bonusmult = 0.6
	elseif GetModConfigData("amulaterate") == 4 then  --40%
		inst.components.fueled.bonusmult = 0.8
	elseif GetModConfigData("amulaterate") == 5 then  --50%  --Controls how much the amulet is refueled per nightmare fuel.  (Default is 50%, equal to 3 minutes.)
		inst.components.fueled.bonusmult = 1.0
	elseif GetModConfigData("amulaterate") == 6 then  --60%
		inst.components.fueled.bonusmult = 1.2
	elseif GetModConfigData("amulaterate") == 7 then  --70%
		inst.components.fueled.bonusmult = 1.4
	elseif GetModConfigData("amulaterate") == 8 then  --80%
		inst.components.fueled.bonusmult = 1.6
	elseif GetModConfigData("amulaterate") == 9 then  --90%
		inst.components.fueled.bonusmult = 1.8
	end

 

To:

inst.components.fueled.bonusmult = GetModConfigData("amulaterate") * 0.2

 

 

And for the variables populating the global table, I'd recommend having a data holder file that returns a blank table.

/scripts/dataholder.lua:

return {}

Then use it to store your stuff in via:

-- file 1
local globals = require("dataholder")
globals.nightsanitydrain = GetModConfigData("nightsanitydrain")

-- file 2
local globals = require("dataholder")
...
if globals.nightsanitydrain == 1 then

That way other mods won't potentially interfere with your globals and you keep your mod more sandboxed.

 

 

In the speech file there's a weird sentence:

ANNOUNCE_ATRIUM_DESTABILIZING

"I think it's Let's get going while the getting's good!",  --Time to go!  --I think it's time to leave!
             ^ Sentence mashed?
...
"I don'tlike the sound of that.",  --It's not safe here.
       ^ Space missing

WILLOW.FIRESTARTER

"It's it hot enough in here?"
 ^ It's -> Is?

 

Edited by CarlZalph
Speech
  • Like 1
Link to comment
Share on other sites

@CarlZalph

Hello again, ^-^

The version you have access to on Steam is likely many months old, and even the most recent version that's online is around a month old.
I've been trying to rewrite a lot of my older code, to make it more efficient and professional.

Thank you for pointing out those errors in the dialogue, that file has not yet been completed or reviewed due to how time consuming it is.

Here is the current version of the mod.  I'm currently working with Miz Artz to create the assets.

image.png.80a8deeaa33ed0ed0a70c0d6720c8d37.png   image.png.36ad9894abc7a6afaafd786aba069144.png  

 

workshop-2238207705 (5.2.21, Non-WildChild).zip workshop-2238207705 (5.2.21, WildChild, Errors).zip

Edited by FurryEskimo
Link to comment
Share on other sites

33 minutes ago, FurryEskimo said:

Here is the current version of the mod.  I'm currently working with Miz Artz to create the assets.

Strange, running the mod both with and without caverns allows me to pick and run around as the character without any errors.

Using the one 'workshop-2238207705  (5.2.21, WildChild, Errors)'.

Since it's finding it fine on my end, could you double verify that the files the game is trying to use are where they're supposed to be?

image.png.cc77d5b2b720ba004d1e719c59b93336.png

  • Health 1
Link to comment
Share on other sites

@CarlZalph

Really?  You got it working?  :D
That's great!  I just tried again and got the same errors as before, but this is good.

(I think) There are files somewhere that remember mod settings.  Perhaps my game remembers the old settings, and needs to be reset, but your game is seeing it for the first time?

I literally copied the files I gave to you, put them in the mod's file, and asked it to run..

image.thumb.png.346f61ddd41b36addb71a67767d86844.png

Link to comment
Share on other sites

1 minute ago, FurryEskimo said:

Really?  You got it working?  :D
That's great!  I just tried again and got the same errors as before, but this is good.

(I think) There are files somewhere that remember mod settings.  Perhaps my game remembers the old settings, and needs to be reset, but your game is seeing it for the first time?

I literally copied the files I gave to you, put them in the mod's file, and asked it to run..

Aye, I didn't need to do anything and it ran.  If you're worried about mod config settings then they're stored in the directory:

C:\Users\<Username>\Documents\Klei\DoNotStarveTogether\<#'s>\client_save\mod_config_data

Another thing you might want to check is if you have some sort of antivirus detecting the file for some reason and preventing it from being read.

Klei had some issues with some of their files before revolving around the client settings folder itself and it was some overzealous antivirus nuking the entire folder.

  • Health 1
Link to comment
Share on other sites

@CarlZalph

Oh this is Wonderful!!

I scrubbed all the mods from my game, redownloaded mine and another (for some reason my mod needed this done, and another that was due for an update.)  I went into my mod and deleted the files, and the whole game closed..  I uploaded the new files, and now it runs normally.  Weird stuff, but it's working!!

Link to comment
Share on other sites

1 minute ago, FurryEskimo said:

Oh this is Wonderful!!

I scrubbed all the mods from my game, redownloaded mine and another (for some reason my mod needed this done, and another that was due for an update.)  I went into my mod and deleted the files, and the whole game closed..  I uploaded the new files, and now it runs normally.  Weird stuff, but it's working!!

Excellent.  Also note that Klei updated Steamworks to use a different folder for mods.  So if you're in-dev of a mod, note that anything you upload to Steam will be downloaded to a different folder than the one in the mods folder you're using.

This may be a case of file conflicts of the one you pushed to Steam versus the one you have there in your mods folder.

Link to comment
Share on other sites

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
 Share

×
  • Create New...