Jump to content

Problem Items icons


W.Williams

Recommended Posts

Hi all,

 

I've a problem with my items icons, they don't display on my inventory but I don't understand why...
 

module MilitaryItems{imports{Base}/*********** Drainable ***********/item CamelbackUCPFull{Type = Drainable,DisplayName = Camelback (UCP),Icon = CamelbackUCP,Weight = 2.5,ReplaceOnDeplete = CamelbackUCPEmpty,UseWhileEquipped =  false,UseDelta = 0.03,ReplaceOnUseOn  = WaterSource-CamelbackUCPFull,IsWaterSource = true,CanStoreWater = true}item CamelbackUCPEmpty{Type = Normal,DisplayName = Empty Camelback (UCP),Icon = CamelbackUCPEmpty,Weight = 0.2,ReplaceOnUseOn   = WaterSource-CamelbackUCPFull,CanStoreWater = true}}

All my icons are 32x32 in PNG format in the repository "mymods/media/textures"
and named with "Item_" before my object.

 

I think the problem comes from my images because when i take picture from other mod it works...

 

This is an example :
http://hpics.li/3bf1b03

 

Best regards
 

Link to comment
Share on other sites

Hi all,

 

I've a problem with my items icons, they don't display on my inventory but I don't understand why...

 

module MilitaryItems{imports{Base}/*********** Drainable ***********/item CamelbackUCPFull{Type = Drainable,DisplayName = Camelback (UCP),Icon = CamelbackUCP,Weight = 2.5,ReplaceOnDeplete = CamelbackUCPEmpty,UseWhileEquipped =  false,UseDelta = 0.03,ReplaceOnUseOn  = WaterSource-CamelbackUCPFull,IsWaterSource = true,CanStoreWater = true}item CamelbackUCPEmpty{Type = Normal,DisplayName = Empty Camelback (UCP),Icon = CamelbackUCPEmpty,Weight = 0.2,ReplaceOnUseOn   = WaterSource-CamelbackUCPFull,CanStoreWater = true}}

All my icons are 32x32 in PNG format in the repository "mymods/media/textures"

and named with "Item_" before my object.

 

I think the problem comes from my images because when i take picture from other mod it works...

 

This is an example :

http://hpics.li/3bf1b03

 

Best regards

 

 

You also need to load the texture into memory which may be why you're having issues, while ones from other mods are working fine.

Here's an example of doing this in my own mod.

--##########--## Init ##--##########require "Items/SuburbsDistributions";--#############--## Sprites ##--#############TTBSprites = {}TTBSprites.getSprites = function()	--Reading Traits		getTexture("Item_TTBBasicRead.png");		getTexture("Item_TTBIntermediateRead.png");		getTexture("Item_TTBAdvancedRead.png");end--##################--## Distribution ##--##################		--Reading Traits		table.insert(SuburbsDistributions["all"]["shelves"].items, "TTB.BasicRead");		table.insert(SuburbsDistributions["all"]["shelves"].items, 0.3);		table.insert(SuburbsDistributions["all"]["shelves"].items, "TTB.IntermediateRead");		table.insert(SuburbsDistributions["all"]["shelves"].items, 0.2);		table.insert(SuburbsDistributions["all"]["shelves"].items, "TTB.AdvancedRead");		table.insert(SuburbsDistributions["all"]["shelves"].items, 0.1);		table.insert(SuburbsDistributions["bookstore"]["all"].items, "TTB.BasicRead");		table.insert(SuburbsDistributions["bookstore"]["all"].items, 0.5);		table.insert(SuburbsDistributions["bookstore"]["all"].items, "TTB.IntermediateRead");		table.insert(SuburbsDistributions["bookstore"]["all"].items, 0.3);		table.insert(SuburbsDistributions["bookstore"]["all"].items, "TTB.AdvancedRead");		table.insert(SuburbsDistributions["bookstore"]["all"].items, 0.1);		table.insert(SuburbsDistributions["Schoolbag"].items, "TTB.BasicRead");		table.insert(SuburbsDistributions["Schoolbag"].items, 1.0);		table.insert(SuburbsDistributions["Schoolbag"].items, "TTB.IntermediateRead");		table.insert(SuburbsDistributions["Schoolbag"].items, 1.0);		table.insert(SuburbsDistributions["Schoolbag"].items, "TTB.AdvancedRead");		table.insert(SuburbsDistributions["Schoolbag"].items, 0.5);Events.OnPreMapLoad.Add(TTBSprites.getSprites);

You need to make the game add your sprites into an array that is loaded when starting a game.

The reason other images from other mods are working is likely because they are already being loaded into memory by their own respective mods, so they work when your own mod tries to use the image.

 

Try modifying the above example to work with what you need and give this a shot, the bit you're concerned with is the event at the bottom and the section handling sprites.

 

EDIT: This goes by the way into .../media/lua/server/...

Link to comment
Share on other sites

I've try your method but it doesn't work either
 

require 'Items/SuburbsDistributions';MISprites = {}MISprites.getSprites = function()getTexture("Item_AsssaultBackpackMulticam.png");getTexture("Item_AsssaultBackpackUCP.png");getTexture("Item_CamelbackMulticam.png");getTexture("Item_CamelbackMulticamEmpty.png");getTexture("Item_CamelbackUCP.png");getTexture("Item_CamelbackUCPEmpty.png");getTexture("Item_CarryallMulticam.png");getTexture("Item_CarryallUCP.png");getTexture("Item_GhillieSuitBottom.png");getTexture("Item_GhillieSuitTop.png");getTexture("Item_HelmetACH.png");getTexture("Item_IOTVMulticam.png");getTexture("Item_IOTVUCP.png");getTexture("Item_KitbagMulticam.png");getTexture("Item_KitbagUCP.png");getTexture("Item_KnifeCaseMulticam.png");getTexture("Item_KnifeCaseUCP.png");getTexture("Item_LegHolsterMulticam.png");getTexture("Item_LegHolsterUCP.png");getTexture("Item_MICH2000HelmetMulticam.png");getTexture("Item_MICH2000HelmetUCP.png");getTexture("Item_MilitaryKnife.png");getTexture("Item_PlateCarrierMulticam.png");getTexture("Item_PlateCarrierUCP.png");getTexture("Item_SFHelmetGreen.png");getTexture("Item_SFHelmetTan.png");getTexture("Item_SharpeningStone.png");getTexture("Item_ShirtMulticam.png");getTexture("Item_ShirtUCP.png");getTexture("Item_TacticalBackpackMulticam.png");getTexture("Item_TacticalBackpackUCP.png");getTexture("Item_TacticalBootsBlack.png");getTexture("Item_TacticalBootsTan.png");getTexture("Item_TrousersMulticam.png");getTexture("Item_TrousersUCP.png");endEvents.OnPreMapLoad.Add(MISprites.getSprites);

I have a display like this in my inventory :

 

http://www.hostingpics.net/viewer.php?id=759971test.png

 

Link to comment
Share on other sites

 

I've try your method but it doesn't work either

 

I have a display like this in my inventory :

 

http://www.hostingpics.net/viewer.php?id=759971test.png

 

 

 

Hmm...

What about if the items you're testing have entries in distribution?

Throwing stuff at the wall here and seeing what sticks but try this and see if it's still the same?

require 'Items/SuburbsDistributions';MISprites = {}MISprites.getSprites = function()getTexture("Item_AsssaultBackpackMulticam.png");getTexture("Item_AsssaultBackpackUCP.png");getTexture("Item_CamelbackMulticam.png");getTexture("Item_CamelbackMulticamEmpty.png");getTexture("Item_CamelbackUCP.png");getTexture("Item_CamelbackUCPEmpty.png");getTexture("Item_CarryallMulticam.png");getTexture("Item_CarryallUCP.png");getTexture("Item_GhillieSuitBottom.png");getTexture("Item_GhillieSuitTop.png");getTexture("Item_HelmetACH.png");getTexture("Item_IOTVMulticam.png");getTexture("Item_IOTVUCP.png");getTexture("Item_KitbagMulticam.png");getTexture("Item_KitbagUCP.png");getTexture("Item_KnifeCaseMulticam.png");getTexture("Item_KnifeCaseUCP.png");getTexture("Item_LegHolsterMulticam.png");getTexture("Item_LegHolsterUCP.png");getTexture("Item_MICH2000HelmetMulticam.png");getTexture("Item_MICH2000HelmetUCP.png");getTexture("Item_MilitaryKnife.png");getTexture("Item_PlateCarrierMulticam.png");getTexture("Item_PlateCarrierUCP.png");getTexture("Item_SFHelmetGreen.png");getTexture("Item_SFHelmetTan.png");getTexture("Item_SharpeningStone.png");getTexture("Item_ShirtMulticam.png");getTexture("Item_ShirtUCP.png");getTexture("Item_TacticalBackpackMulticam.png");getTexture("Item_TacticalBackpackUCP.png");getTexture("Item_TacticalBootsBlack.png");getTexture("Item_TacticalBootsTan.png");getTexture("Item_TrousersMulticam.png");getTexture("Item_TrousersUCP.png");table.insert(SuburbsDistributions["all"]["shelves"].items, "MilitaryItems.CamelbackUCPFull");table.insert(SuburbsDistributions["all"]["shelves"].items, 0.0);table.insert(SuburbsDistributions["all"]["shelves"].items, "MilitaryItems.CamelbackUCPEmpty");table.insert(SuburbsDistributions["all"]["shelves"].items, 0.0);endEvents.OnPreMapLoad.Add(MISprites.getSprites);
Link to comment
Share on other sites

I've already this part, but it takes 500 lines, and it's complicated to display this here.

Hmmm, ok.

Well I guess let's work down all the possibilities, we'll find the cause eventually.

 

Ok so first up, can you take a screenshot of the contents of the textures folder inside your mod or specifically the icons for two items you linked in your first post as shown inside the folder?

 

Maybe it's a filename thing or perhaps even a folder directory?

Your textures folder is: .../ mods/YOUR_MOD_NAME/media/textures/... right?

And the filenames are "Item_<name>.png" right? (Item_CamelbackUCP.png for example)

Link to comment
Share on other sites

Yes, this is the folder with all the textures 32x32 and Item_myobjectmod

 

http://www.hostingpics.net/viewer.php?id=405239example.png

Hmm, that looks to be alright.

Ok, how about this.

Does this happen with all items in your mod?

 

I notice some of the stuff in your mod item list looks like it might be clothing?

I could be wrong, but as I understand it Zomboid doesn't have explicit icons for clothing but instead generates one based on stuff like colour settings off a template image it has?

 

Again, a bit off the wall, but since it seems like your textures are set up right, being loaded AND are set right in items, it has to be something a bit unusual.

 

Do you have any non-clothing items in your mod at the moment that we could test an icon on perhaps?

If not, try this and see if the same thing happens with a really generic item

/************************ITEMS************************/item MIDebugItem	{		Weight		=	0.5,		Type		=	Normal,		DisplayName	=	MI Icon Debug Object,		Icon		=	CamelbackUCP,	}
Link to comment
Share on other sites

it happens with all items in my mods and yes somes items and clothing and works with this code :

item ShirtUCP{BodyLocation = Top,Type = Clothing,SpriteName = Blouse,Palettes = Blouse_White,PalettesStart = Blouse_,Temperature = 12,Weight = 0.8,DisplayName = Shirt (UCP),Icon = ShirtUCP,}

And i have several items that are normal like Helmet but they don't work...

 

item HelmetACH{Type = Normal,DisplayName = ACH Helmet,Weight = 0.2,Icon = HelmetACH,}

But when i take an icon from an other mod (e.g ORGM), my icons appears on the inventory, i really think, the problem are my icons...

Link to comment
Share on other sites

Ok this is the FINAL ANSWER, when you use GIMP for your icons you have to manually set pixel height and width (32 x 32)

 

/!\ EXREMELY IMPORTANT /!\

 

The resolution as to be 32 pixel/in on the axe "X" and 32 pixel/in on the axe "Y" 

and you can have a linear interpolation (better quality) or none interpolation.

 

Thank you all !

Link to comment
Share on other sites

  • 8 months later...

Your issue shouldn't be coming from the graphic program. I've found that 32 width is needed but I am working on a graphic now that has 64 px height. 72 ppi (points per inch) is all you need for screen work. Anything more is wasted, causing file bloat and numerous other issues. 

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