Jump to content

how to properly call assets from the inventory images xml


Recommended Posts

does anyone know of a way to use existing inventory assets for modded items? I want to make it so that the items I'm adding use the butterfly and butterfly wing inventory images, but since they dont have the same name as the .tex, the game won't access them and will crash

basically, I'm trying to make evil butterflies that work the same way as regular butterflies, but will spawn and spawn from evil flowers.

Here are the files in question:

prefabs
evilbutterfly.lua

evilbutterflywings.lua

components

evilbutterflyspawner.lua

evilpollinator.lua

right now I can plant evil butterflies to make evil flowers, but evil flowers still spawn regular butterflies, and the evil butterfly prefabs don't have inventory icons.
 

I tried to use

inst.components.inventoryitem.atlasname = "images/inventoryimages/butterfly.xml"

to make the evil butterfly use the existing butterfly icon, but the game crashed.

Should I just try to make new inventory icons for these items, and if so, what's the best way to decompile and edit the existing ones and then recompile them

Link to comment
Share on other sites

3 minutes ago, its zea said:

decompile the game files, and add the images into your modded folder and call on them from there.

how do I do that with the static images though? I know how to decompile the animations but I don't know how it works for the non-animated stuff

 

Link to comment
Share on other sites

1 minute ago, MF99K said:

how do I do that with the static images though? I know how to decompile the animations but I don't know how it works for the non-animated stuff

 

Decomplie the animations into static images and an .scml file. Place those files into your exported folder. Then call upon as you would your own images.

Jessie is correct and it probably cleaner and easier to use in-game files.

Edited by its zea
Link to comment
Share on other sites

Just now, its zea said:

Decomplie the animations into static images and an .scml file. Place those files into your exported folder. Then call upon as you would your own images.

I would use krane for the static images?

Link to comment
Share on other sites

if you're not going to edit anything, you can just use setimagename or whatever the function's name was, which would save you a lot of time

Just now, its zea said:

Yes, I recommend making a .bat file inside the ktools folder that way you don't have to type put the command each time.

this is incorrect, you can't use krane for converting TEX files

Link to comment
Share on other sites

9 minutes ago, MF99K said:

krane doesnt work for what I need, is ktech the decompiler for static images and if so how do I use it?

Sorry I did not read properly for inventory icon yes ktech as jessie said. sorry for the confusion.

Link to comment
Share on other sites

33 minutes ago, its zea said:

Post an updated download of your file. Ill see if spot the problem. Also posting your errors would help.

I'm not getting any crashes so there arent any errors. as for what the bug looks like:
image.png.014db07518ffdbab8652177c006d5602.png

 

and the only lines of code I edited:
image.png.663f773e426a96fda5cd6f64c8dca0e2.png
(the other was the same but evilbutterflywings.xml)

 

edit: .tex works fine on the mod listing so there's something wrong with the inventory image in the code and not the asset itself image.png.b2ceaa142c458cf8b59390cb0544356f.png

Edited by MF99K
Link to comment
Share on other sites

26 minutes ago, MF99K said:

I'm not getting any crashes so there arent any errors. as for what the bug looks like:
image.png.014db07518ffdbab8652177c006d5602.png

 

and the only lines of code I edited:
image.png.663f773e426a96fda5cd6f64c8dca0e2.png
(the other was the same but evilbutterflywings.xml)

If you made a copy of the images and put them in your mod folder, make sure to point to them under "local assets=" You also need a .tex file as that it was contains the image. Atlas just contain information needed to display the image. Also list the assests in your modmain.lua

i.e. Asset("ATLAS", "images/inventoryimages/evilbutterfly.xml"),
      Asset("IMAGE", "images/inventoryimages/evilbutterfly.tex"),

 

If you are calling upon the game files then try "dontstarve/common/together/ect/ect <-- wherever that particular xml is. I have not play around with this as I have always made my own images, but that seems to be the path other files use.

Edited by its zea
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...