Jump to content

Recommended Posts

20220517173906_1.thumb.jpg.08c4f952492148854e1c9653f70c8ee2.jpg

Hello, I'm creating a character with a unique weapon. Even making a weapon and applying it to a character was successful. However, when launching the game and crafting a weapon, the crafting icon is displayed as the default axe. Tool thumbnails don't even appear, and once crafted, the character is holding something 'transparent'. The image of the weapon seems to have been inserted correctly, but the image is not applied. (The icon is normally entered when in the inventory.) Does anyone know about this error? What code am I missing?

modmain.lua tranquility.lua siran.lua

Edited by ONIVERSE

The item being invisible in hand is likely something wrong with the values inside OnEquip, specifically AnimState:OverRideSymbol(). Taking a snippet from the custom item templates found in the Tutorials and Guides section of the forums, here's how it should be structured to avoid the invisible issue

owner.AnimState:OverrideSymbol("swap_object", "Your_build(*.zip_filename)", "Symbol_from_your_build(name_of_subfolder_with_art)")

 

As for the inventory icon issues, in your item's prefab, comment out these 2 lines underneath AddComponent("inventoryitem"),

    inst.components.inventoryitem.imagename = "tranquility"
    inst.components.inventoryitem.atlasname = "images/inventoryimages/tranquility.xml"

and put this somewhere in your file, OUTSIDE OF A FUNCTION, and before the return at the bottom.

RegisterInventoryItemAtlas("images/inventoryimages/tranquility.xml","tranquility.tex")

This will properly register your item's icon with the game, as long as the name of your prefab is the same as the filename of the tex, it will work fine, and should fix both inventory icon issues. If it doesn't, leave another comment here though.

 

Side things, the structure of your tranquility.lua file is a little strange, having your OnEquip and OnUnequip functions inside your constructor fn isn't necessarily wrong, but doesn't line up with how it's normally done, and also, at the bottom you have it returning common/inventory/tranquility. To be honest, I have no idea what that does, if it does anything different, than just returning the name of the prefab.

  • Thanks 1

I tried as you said, the images in the crafting tab are working fine! I express my sincere respect and gratitude to you. But still the weapon itself is transparent, nothing in hand... I thought I changed everything properly, but I can't find where I'm going wrong... If possible, could you please take a look at the full file of my mod? I really can't figure out where the problem is.

 20220517211310_1.jpg.f278778a8a92861d0509180327dc275d.jpg

Siran.zip

Edited by ONIVERSE

I believe your issue is that your image file for swap_tranquility isn't inside a folder, it's just sitting in the same folder as the spriter project. Try making it like this

image.thumb.png.331cd59c52f54d9e19229dd29f92c4ac.png

With swap_tranquility.png being inside that new folder, and make sure to correct your spriter project with the correct new image, as it won't find the old one now that you've moved it.

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