Jump to content

Crash with character w/ custom items, unexpected end of data


Recommended Posts

I'm trying to make a custom character with a few custom items, a set of craftable burger food items. I've been through the wringer fixing textures and editing code, but I've hit a road block that I just can't get past.

[00:00:59]: 	Unload FE	
[00:00:59]: 	Unload FE done	
[00:01:00]: Mod: Whoopee (Whoopee the Fry Cook)	Registering prefabs	
[00:01:00]: Mod: Whoopee (Whoopee the Fry Cook)	  Registering prefab file: prefabs/whoopee	
[00:01:00]: Mod: Whoopee (Whoopee the Fry Cook)	    whoopee	
[00:01:00]: Mod: Whoopee (Whoopee the Fry Cook)	  Registering prefab file: prefabs/whoopee_none	
[00:01:00]: Mod: Whoopee (Whoopee the Fry Cook)	    whoopee_none	
[00:01:00]: Mod: Whoopee (Whoopee the Fry Cook)	  Registering prefab file: prefabs/burger	
[00:01:00]: Mod: Whoopee (Whoopee the Fry Cook)	    burger	
[00:01:00]: Mod: Whoopee (Whoopee the Fry Cook)	  Registering prefab file: prefabs/vegburger	
[00:01:00]: Mod: Whoopee (Whoopee the Fry Cook)	    vegburger	
[00:01:00]: Mod: Whoopee (Whoopee the Fry Cook)	  Registering prefab file: prefabs/monburger	
[00:01:00]: Mod: Whoopee (Whoopee the Fry Cook)	    monburger	
[00:01:00]: Mod: Whoopee (Whoopee the Fry Cook)	  Registering prefab file: prefabs/slider	
[00:01:00]: Mod: Whoopee (Whoopee the Fry Cook)	    slider	
[00:01:00]: Mod: Whoopee (Whoopee the Fry Cook)	  Registering default mod prefab	
[00:01:00]: unexpected end of data

I don't know what could be causing it, I've been over the code multiple times but I just can't figure it out.

I've attached a rar of the mod for people to test with.

Whoopee.rar

Link to comment
Share on other sites

First off the in game name for your character is Esc, I fixed that, I made that same mistake too when making my character, I'm still looking through the lines of code to see if there is anything missing. In Whoopie.LUA why do you have all these files under assets?

Take a look at my character's Character/scripts\andreas.lua This is uses the same template you used for your character and I'm not having many problems, other than a supposed un closed "}" in modmain.lua that I cannot find.

 

 

Andreas Nylleri Moon.zip

Link to comment
Share on other sites

In your modmain.lua, your PrefabFiles table finish with a "," as well as the Assets table. The last element of a table should not have a trailing coma.

I stopped checking it out after seeing that. You should first make sure that everything is formatted properly. I would suggest to take a bit of time and read https://www.lua.org/manual/5.3/manual.html

Edited by ZupaleX
Link to comment
Share on other sites

1 hour ago, Andreasgamming said:

First off the in game name for your character is Esc, I fixed that, I made that same mistake too when making my character, I'm still looking through the lines of code to see if there is anything missing. In Whoopie.LUA why do you have all these files under assets?

Take a look at my character's Character/scripts\andreas.lua This is uses the same template you used for your character and I'm not having many problems, other than a supposed un closed "}" in modmain.lua that I cannot find.

 

 

Andreas Nylleri Moon.zip

Thanks for catching the Esc thing, firstly.

The files there were from an older mod I'd made, it was one of my attempts at fixing the issue, but it didn't yield any results. I've removed them for the time being.

Other than that, I can't find anything that leaps out as being especially different between ours, aside from my own custom items.

For the record, I found where your error is

34    Asset( "IMAGE", "bigportraits/andreas_none.tex" ),
35    Asset( "ATLAS", "bigportraits/andreas_none.xml" ),
36
37	Assets = {	Asset("SOUNDPACKAGE", "sound/andreas.fev"),
38	Asset("SOUND", "sound/´andreas.fsb")
39}

On line 37 you have an extra "Assets = {"

27 minutes ago, ZupaleX said:

In your modmain.lua, your PrefabFiles table finish with a , as well as the Assets table.

I stopped checking it out after seeing that. You should first make sure that everything is formatted properly.

I went through the luas and fixed any of the closing errors as you described, but nothing seems to have changed.

Whoopee.rar

Edited by EverSoNitro
Attached the most recent version, with the described edits
Link to comment
Share on other sites

Ok, I actually checked it more into the details:

All your xml files in images/inventoryimages are wrong. How did you generate it? I deleted them all and let the autocompiler generate it for me and the mod loads.

Also you need to include the tex in all your prefab files, i.e.

local assets =
{
	Asset("ANIM", "anim/slider.zip"),
    Asset("ATLAS", "images/inventoryimages/slider.xml"),
	Asset("IMAGE", "images/inventoryimages/slider.tex")
}

BTW, just to make it perfectly clear: lua allows trailing comma, it's just that you should be careful and try to have a nice formatting as it will help you to debug things :)

Edited by ZupaleX
Link to comment
Share on other sites

25 minutes ago, ZupaleX said:

Ok, I actually checked it more into the details:

All your xml files in images/inventoryimages are wrong. How did you generate it? I deleted them all and let the autocompiler generate it for me and the mod loads.

Also you need to include the tex in all your prefab files, i.e.


local assets =
{
	Asset("ANIM", "anim/slider.zip"),
    Asset("ATLAS", "images/inventoryimages/slider.xml"),
	Asset("IMAGE", "images/inventoryimages/slider.tex")
}

BTW, just to make it perfectly clear: lua allows trailing comma, it's just that you should be careful and try to have a nice formatting as it will help you to debug things :)

The xml files were something I fiddled with to try to get it to work.

I did everything you said and it works! Thank you, you've helped with so many headaches.

While the thread is still open though, I'd like to add a function to have it so Whoopee doesn't lose sanity at night (i.e. his "Aspiring Astronomer" trait). Just at night, not in complete darkness. How would I go about doing that?

Link to comment
Share on other sites

If you want your character to not lose sanity at night time, but still lose Sanity when in darkness you put this code outside your master_postinit

local function Aspiring_Astronomer(inst)
	if inst.LightWatcher:IsInLight() and TheWorld.state.isnight then
		inst.components.sanity.night_drain_mult = 0
	elseif not inst.LightWatcher:IsInLight() and TheWorld.state.isnight then
		inst.components.sanity.night_drain_mult = 1
	elseif not TheWorld.state.isnight then
		inst.components.sanity.night_drain_mult = 1
	end
end

then this code inside your master_postinit

inst:DoPeriodicTask(1, Aspiring_Astronomer)

 

Link to comment
Share on other sites

3 minutes ago, SuperDavid said:

If you want your character to not lose sanity at night time, but still lose Sanity when in darkness you put this code outside your master_postinit


local function Aspiring_Astronomer(inst)
	if inst.LightWatcher:IsInLight() and TheWorld.state.isnight then
		inst.components.sanity.night_drain_mult = 0
	elseif not inst.LightWatcher:IsInLight() and TheWorld.state.isnight then
		inst.components.sanity.night_drain_mult = 1
	elseif not TheWorld.state.isnight then
		inst.components.sanity.night_drain_mult = 1
	end
end

then this code inside your master_postinit


inst:DoPeriodicTask(1, Aspiring_Astronomer)

 

Thanks! I'll come back to this thread if any further issues arise, but for now I think I'm good!

Link to comment
Share on other sites

Okay, so after testing, I've discovered that any player can make Whoopee's items, which isn't something I want. I've also decided I want to add a couple more exclusive items (a hat and an apron to go in the chest slot) and so I figure that the best way to go about doing so was to give him an exclusive crafting tab (we'll refer to it as the Fry Cook tab). However, I don't have any idea how to go about doing so.

I also wanted to know if clothing and armor type items simply obscure the torso or if they completely overwrite it.

Edited by EverSoNitro
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...