Jump to content

When creating a custom item in DST character mod, it exists in the world, but it cannot be seen. The textures exist and the game sees a path to them, but they are not displayed.


Recommended Posts

Here is my code :

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


local function fn()
    local inst = CreateEntity()
    
    inst.entity:AddTransform()
    inst.entity:AddAnimState()
    inst.entity:AddMiniMapEntity()
    inst.entity:AddNetwork()
    
    inst:AddTag("onix")
    inst:AddTag("umbrella") 
    
    MakeInventoryPhysics(inst)
    
    inst.AnimState:SetBank("onix_umbrella")
    inst.AnimState:SetBuild("onix_umbrella")
    inst.AnimState:PlayAnimation("idle")
    
    inst.MiniMapEntity:SetIcon("onix_umbrella.tex")
    
    inst.entity:SetPristine()
    
    if not TheWorld.ismastersim then 
        return inst
    end
    

    inst:AddComponent("inspectable")
    inst:AddComponent("inventoryitem")
    inst.components.inventoryitem.atlasname = "images/inventoryimages/onix_umbrella_inventory.xml"
    inst:AddComponent("equippable")
    inst.components.equippable.equipslot = EQUIPSLOTS.HANDS
    inst.components.equippable:SetOnEquip(function(inst, owner) 
        owner.AnimState:OverrideSymbol("swap_object", "onix_swap_umbrella", "onix_swap_umbrella") 
        owner:ListenForEvent("unequip", function() 
            owner.AnimState:ClearOverrideSymbol("swap_object") 
        end) 
    end)

    return inst
end

return Prefab("onix_umbrella", fn, assets)

The item exists in the game and it can be dropped and given to the character in his hands or in his inventory, but it is completely invisible in any position! The textures for it have been rendered and are in the right folders in the right formats. In TEX and XML formats. The game does not issue errors at startup and during code processing, which means it sees these very files and has access to them. Could there be a problem with the file search itself? I'm an artist with no programming experience, I did everything through YouTube videos. So far, this is just a retexture of an ordinary umbrella, without skills Has anyone had the same problem? Could you please share the solution?

This is my first mod and I really want to finish it.

Also, my English knowledge is very poor and therefore I use a translator, there may be mistakes. I really love this game and hope they will help me (*´▽`*)

изображение_2025-04-26_203408323.png

изображение_2025-04-26_203604995.png

изображение_2025-04-26_211255793.png

изображение_2025-04-26_211446729.png

well @NPCMaxwell is on holiday right now but if i am not mistaken he had a simillar problem about a week ago(though he was working with a character not an object so maybe it is very different)

  • Sad 1

Thank you, I also had this problem at the character creation stage. She decided to recompile the files. Is there any way to contact this person and ask him if he also created custom items?

Since I am not on my PC and can‘t help directly, can you maybe re-make all your steps from the beginning and posts screenshots of them? Also did you add the new onix-umbrella zip files to modmain‘s „shopping list“?

(I still hope someone else can help meanwhile since I really suck at helping when I can‘t attempt to try troubleshooting stuff I suggest on my own PC first)

Edited by NPCMaxwell

I see no mention of a .scml file in your post. Have you created one for your item? Is everything in the .scml file itself named correctly? Usually when my items did not appear I had forgotten to rename the animation list inside of the .scml.

Unfortunately, I don't have the experience to attempt to fix your problem without your mod files to look at and edit directly. I'm only an artist as well, but I've made custom items several times. If you attatch your files here I will take a look at it for you.

If you do not want to send your files, you can try following this template to make the item again: 

 

Edited by Chesed
  • Like 1

I didn't do custom animations. I just pulled the files with the original umbrella from the game itself, transferred them to png, made a retexture and transferred them back to tex. I provided a screenshot of the files in the post. I have only tex and bin files in the anim folder. I moved the bin files from the folder with the original umbrella and did not interact with them in any way.

 

onix_umbrella.zip onix_swap_umbrella.zip

I think you may need to rename the bin of the animation via a specific tool, that I sadly atm can't remember the name of, so the game doesn't get confused with the old umbrealla and the new one (I think a creature retexture tutorial that can be found on steam and here explains how to rename it at some point)

Nevermind I was confused myself. sadly I can't help when I don't have a computer near me. But considering you actually did make your recoloured umbrella into a custom handheld object I REALLY suggest you re-making your custom umbrella with the custom hand-held item and /spriter/ method. It's not much different then the method you used but if it's still invisible then, maybe it will be easier for other users to help you. (I'm sorry I am useless when I am not at home)

  • Like 1

I attempted to extract the sprites from the files you sent me with Ktools, but they do not contain your sprites (they only have the normal umbrella sprites). This says to me that they have not compiled properly.

If you are making a new item that just also looks like an umbrella, you can't just rip the sprites of the existing umbrella and repack it with a texture tool - your .bin will not have the correct information in it. I highly recommend using the Don't Starve Together Mod Tools Autocompiler instead. You can find it through Steam.

To help you out (if that's what you're doing) I've made an example mod for you with the correct image setup. All you need to do is copy the files from the "exported" folder to your mod, open the .pngs, put your sprites in them, save them, and run the Autocompiler. You can also reference the code in onix_umbrella.lua and compare it to what you have. I hope this simplifies things.

If you are following a "reskinning items/creatures" tutorial and are replacing the existing umbrella I cannot help you, sorry.

I hope this helps you! I wasn't sure how to explain things so I thought just making an example would save time.

umbrella.zip

______________________________________________

...Sorry to double post but I just realised that the code you posted doesn't econtain an "onequip" function. What a thing for me to not even notice! X) Look in the onix_umbrella.lua that I sent you in that template. You need an "onequip" and "onunequip" in your item so the game can place the item in your character's hands. I'm so sorry that I didn't even notice that hahahah.

Edited by Chesed
I tried to make a second post to notify you but it got merged >_<

Thank you all so much for your help, but when I change the textures, everything doesn't work again, although before that I converted everything from tex to png and back.
I think I'm pretty burned out working alone on this mod, and the right decision would be to take a break.
Is there any way I can help you in response? Should I draw sprites there or something else related to illustration?
(By the way, my friend loves Hesed from the L. Corporation. It's a funny coincidence)

 

Edited by ENMARIARA

(Sorry for the late reply, I was busy with my job.) 

I'm very sorry to hear it didn't work out. :( If you come back to the mod in the future and still cannot get it to work, you can send your mod and your .png files of your umbrella sprites to me, and I will try to fix it for you. I have done stuff like this for a few people on the forums before so I don't mind doing it. You can post them here or send them privately if you want to. But it's okay if you prefer to fix it yourself!

I don't need anything in return - I like to help people on the forums because the forums have helped me out a lot. If you really want to draw me something, you can doodle Chesed, or one of my characters from my art thread (my characters are behind the spoiler tags). You don't have to though! I'm happy to help for nothing.

(Also your friend has good taste in characters hahahaha, Chesed is my favourite from L. Corporation!!!)

Edited by Chesed

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
×
  • Create New...