Jump to content

How to add new icons for vanilla items


SillySalamanda

Recommended Posts

I've created some icons for a retexture mod of the vanilla baseball caps and I'm really struggling trying to get the game to use the new icons I've created. The retexture of the baseball caps works without the need of any scripts, but this does not appear to be the case for the icons. I've tried using a script and I have had some luck using the "override = true" function. I got the new icons to show up in game when zombies were wearing the baseball caps, however when looting containers, any baseball caps within them are still using the vanilla icons. Does anyone know why this is? I've attached the script that I've been using, any help would be greatly appreciated. Thanks in advance.

module_clothing_HatRetexturePack.txt

Link to comment
Share on other sites

  • 3 weeks later...

Could you use DoParam to edit the vanilla items?  Something like:

 

local item = getScriptManager():getItem("Base.Whatever")
if item then
	item:DoParam("Icon = NewIconName")
end


Save the lua file into /media/server/

I've done something similar to add tool tips to vanilla items.

Link to comment
Share on other sites

On 10/1/2022 at 8:35 PM, SillySalamanda said:

I've created some icons for a retexture mod of the vanilla baseball caps and I'm really struggling trying to get the game to use the new icons I've created. The retexture of the baseball caps works without the need of any scripts, but this does not appear to be the case for the icons. I've tried using a script and I have had some luck using the "override = true" function. I got the new icons to show up in game when zombies were wearing the baseball caps, however when looting containers, any baseball caps within them are still using the vanilla icons. Does anyone know why this is? I've attached the script that I've been using, any help would be greatly appreciated. Thanks in advance.

module_clothing_HatRetexturePack.txt 4.15 kB · 1 download


Couple of things:

 

1) You need to put the clothing items in the module Base, as putting them in your own module is creating brand new items.

2) As you have created new items and re-used the 'ClothingItem' property of a vanilla item this confuses the game, so when the game looks for that ClothingItem it now finds your modded item instead of the vanilla item.  This results in zombies wearing the modded item instead of the vanilla item, but it doesn't impact on loot in containers because the loot system only uses item name (and it will assume module Base if none is specified).

The DoParam method I mentioned above is probably a better fix - that way any changes made by the devs won't be affected.  Re-declaring the item and overriding will replace the item and any future changes made to those items will be lost.

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