Jump to content

Need help with invisible custom food item, and missing description.


Recommended Posts

Hello All!

I'm having some trouble making my custom food item show up. I've fixed enough so the game no longer crashes on startup, but unfortunately the textures for the Flatbread are not showing up. Additionally, no description appears when selecting the item, and it does not give an option for inspect.

Basically, I'm not sure where to start with fixing this, though i have a feeling it has something to do with the anim files?

Any help would be greatly appreciated!

client_log - Copy.txt

redO.zip

Link to comment
Share on other sites

Hello, you seem to be missing some line of codes in your files that prevented your prefab ("seamonster") to function properly. But don't worry, I think I managed to fix the issues and I'll try my best to walk you through it. :)

So, the first problem I noticed was that in your "seamonster.lua" under the "prefabs" folder had some incorrect codes:

inst.AnimState:SetBank("seamonster")
inst.AnimState:SetBuild("seamonster_build")
inst.AnimState:PlayAnimation("idle", false)

I've added a bit of codes to simplify the process and remove some codes that I thought to be unnecessary. It now looks something like this :

local inst = CreateEntity()
local trans = inst.entity:AddTransform()
local anim = inst.entity:AddAnimState()
	
anim:SetBank("seamonster")
anim:SetBuild("seamonster") --1 anim is enough since it's not equippable.
anim:PlayAnimation("idle") -- I removed the "false"

Also I've removed the .txt file in the "exported/seamonster" folder but I'll talk more about that later on.

You also didn't specify where the "atlas" is located for the "inventoryimage" after you added the component "inventoryitem". So I decided to add it myself:

inst:AddComponent("inventoryitem")
inst.components.inventoryitem.imagename = "seamonster"
--This bit --v
inst.components.inventoryitem.atlasname = "images/inventoryimages/seamonster.xml"

The "STRINGS...." lines should be placed in the "modmain.lua" since "STRINGs" hasn't been defined to be "GLOBAL.STRINGS". So, I did that.

Other than that this file's good to go! :)

Now onto the modmain.lua!

Under the "Assets" table or whatever you call it (it's at the beginning), you don't need to add the "seamonter" 's inventory image again since it's already been done in its own prefab file. So you can remove that from there.

Then near the end, the prefab name "seamonster" should have been capitalized (I think it's necessary but I'm not 100% sure). So it should be something like this:

STRINGS.NAMES.SEAMONSTER = "Seamonster Flatbread"
STRINGS.CHARACTERS.GENERIC.DESCRIBE.SEAMONSTER = 
{
	"Apparently the only choice, when it comes to flatbread.", --I changed this part a bit just in case you want more than 1 dialogues.
	"This bread looks funny.", --make sure you end each dialogue with a coma or it wont work! 
}

Next is the inventory image itself. You need to make sure that the image is 64x64 because otherwise the image would either go outside of the inventory box or doesn't show at all. (Not sure which one :p)

And finally, the layout on how the "exported/seamonster" is wrong. The .scml shouldn't be on the same folder as the image because it won't work otherwise. So you need to create another folder within "seamonster" and put the image there. Then you need to delete the old .scml because the root is incorrect (the root is where the .scml is set to look for the images). Create a new project, select the correct root folder and so on. Then place the image down, position it correctly (You don't need to change the pivot point unless you really want to)  and change the name of the animation to your prefab (entity_000 > seamonster) and the "NewAnimation" to "idle". Save the project as "seamonster.scml" inside the "exported/seamonster" folder. 

After all of that, compile the files, and test your mod out. The images for "seamonster"  should now show within the game and has the examine/inspect option. If it doesn't then I might have forgotten to add some extra information, so sorry if that happens. ;) 

Here's the mod files that worked for me:

redO.zip

I've also fixed the "bigportrait/red_none" and the "names_red" issue where it's not showing within the game. (Not that you asked for it but I did anyway :) )

1TBcX5v.png

 

...now I'm gonna grab something to eat. :)

Link to comment
Share on other sites

Thank you so much for the help! I'm excited to keep adding more features, and I really appreciate such an in depth response ((the bigportrait has been puzzling me for a long time too!))

I'll look into implementing the changes as soon as i can.

Thanks again!

 

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