Jump to content
Sign in to follow this  
Kirbyarm

Custom Item Icons

Recommended Posts

Hello everyone, I created an old mod when I used to play this. I could load individual .png image files and they loaded in the game perfectly fine, but after re-working my mod (took several hours this morning) to apply it to and include all of the latest changes in the game, none of the custom images work anymore. Everything else works but the images. They are mostly Item_ icons, and one Objects_ file.

Previously I used this code in a random lua for it to work:

function TestItemIcons.loadTextures()
    getTexture("Item_Cigar.png");
end

Events.OnGameBoot.Add(TestItemIcons.loadTextures);

----

Please can someone help me get my custom images to be loaded by the game again? My friend and I are eager to get back into the game and we're just waiting on this last bit of info, thanks everyone.

Share this post


Link to post
Share on other sites

Custom Icons for items don't need to be loaded through .lua code, you just need to set the right icon name in the item script and it will work.

Icon = CustomIcon,

That for example would work if the file name of the icon in media\textures of your mod is Item_CustomIcon.png

Share this post


Link to post
Share on other sites

Thank you! It works for the item icons.

 

Could you please tell me how I would adjust my code for the crop sprite? I have three fully growable, farmable crops but I am unsure if the textures will load correctly:

 

farming_vegetableconf.sprite["Tobacco"] = {
"Item_seededTobacco",
"Item_tobacco",
"Item_tobaccoBloom",
"Item_tobaccoMature",
"Item_tobaccoRotten"
}

 

This is what I made back in the day ^

 

Thanks for your time. :)

Share this post


Link to post
Share on other sites

Unortunately nothing in that thread helped me solve the problem as it seems to use the Packer method or default-available textures, but it did make me think outside the box a bit and try various assortments of the direct pathname. I am not 100% sure it worked, but I am 99.5% sure because the seedlings for each crop are no longer invisible, and they are using the correct icons and texture! Yay!

 

Image files for Tobacco crop:

-Item_tobacco1.png

-Item_tobacco2.png

-Item_tobacco3.png

-Item_tobacco4.png

-Item_tobaccoBloom.png

-Item_tobaccoMature.png

-Item_tobaccoRotten.png

 

For those interested who have similar problems, here is what I had to change in the farming code to get it working (for one of my crops):

 

planting = growNext(planting, "media/textures/Item_tobacco1.png", farming_vegetableconf.getObjectName(planting), nextGrowing,farming_vegetableconf.props[planting.typeOfSeed].timeToGrow + water + diseaseLvl);

 

planting = growNext(planting, "media/textures/Item_tobacco" .. nbOfGrow .. ".png", farming_vegetableconf.getObjectName(planting), nextGrowing, farming_vegetableconf.props[planting.typeOfSeed].timeToGrow + water + diseaseLvl);

 

planting = growNext(planting, "media/textures/Item_tobaccoBloom.png", farming_vegetableconf.getObjectName(planting), nextGrowing, farming_vegetableconf.props[planting.typeOfSeed].timeToGrow + water + diseaseLvl);

 

farming_vegetableconf.props["Tobacco"].texture = "media/textures/Item_tobaccoMature.png";

 

farming_vegetableconf.sprite["Tobacco"] = {
"media/textures/Item_tobacco1.png",
"media/textures/Item_tobacco2.png",
"media/textures/Item_tobacco3.png",
"media/textures/Item_tobacco4.png",
"media/textures/Item_tobaccoBloom.png",
"media/textures/Item_tobaccoMature.png",
"media/textures/Item_tobaccoRotten.png"
}

 

 

Custom Icons for items don't need to be loaded through .lua code, you just need to set the right icon name in the item script and it will work.

Icon = CustomIcon,

That for example would work if the file name of the icon in media\textures of your mod is Item_CustomIcon.png

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...