Jump to content

Adding custom sprites for items (and traits)


Kjulo

Recommended Posts

I've tried following this guide on how to implement custom sprites, but i can't seem to get it working. The picture is in the root folder.

 

LUA code: (It is implemented correctly since i get the items)

Make_Shift_Mod_icons = {}----- This loads the textures. You can add as many-- as you want.function Make_Shift_Mod_icons.loadTextures()    getTexture("Item_PillowHandBag.png");end----- This will add the item to the inventory for-- testing purposes.function Make_Shift_Mod_icons.giveItems()    getSpecificPlayer(0):getInventory():AddItem("Base.Pillow");	getSpecificPlayer(0):getInventory():AddItem("Base.Bullets9mm");endEvents.OnGameBoot.Add(Make_Shift_Mod_icons.loadTextures);Events.OnGameStart.Add(Make_Shift_Mod_icons.giveItems);

And then the items i want added (They are also in-game)

module Make_Shift_Pillow{    imports    {        Base    }		item PillowHandBag	{		WeightReduction	=	35,		Weight	=	0.1,		Type	=	Container,		Capacity	=	10,		DisplayName	=	Pillow Sheet Bag,		Icon	=	Item_PillowHandBag.png,		WeaponSprite	=	Item_PillowHandBag.png,	}    recipe Empty Pillow	{        Pillow,        Result:PillowHandBag,        Time:5.0     }	 }

The icon is just a question mark, implying that it cannot find the textures.

 

Also, if anyone knows how to add custom traits icons, i would be more than happy.

Link to comment
Share on other sites

Remove the Item_ part of the Icon= tag, of you item scripting.

Thanks, it works not.

 

 

Not sure if the weapon sprite works for mods yet. Don't know about trait sprites, RoboMat does.

Edit: Containers don't use the weapon sprite tag..

i used the weapon sprite tag because i tried out different methods. I just forgot to remove it.

Link to comment
Share on other sites

So you got it working?

kgw4jJE.png

Yep, although i still have trouble with the trait icons

 

in "\media\ui\Traits" i have made a duplicate image named "tz_nerve"
TraitFactory.addTrait("tz_nerve", "Nervous", -1, "Never feel safe", false);

Icon dosen't show up, but the trait does

Link to comment
Share on other sites

Ah crap that's my bad ... sorry. You  have to name it:

trait_kjulo_nerve.png

and then you can do it like this:

TraitFactory.addTrait("kjulo_nerve", "Nervous", -1, "Never feel safe", false);

the "tz_" part in my icons was just because they were made by thuztor ;)

VowTM6d.png

Many thanks.

Link to comment
Share on other sites

Yup, I discovered the trait icon trick on the old forum after many posts trying to solve it... it's simple but you expect to have to specify one, right (as you do for professions)? Nope, just put the icon file in the right folder and give it the correct name! As long as the icon and trait names match, it works. :)

 

Correct me if I'm wrong, but 2.9.9.17 has a bug in the mod loader that prevents item mods working... though they should work if you install a mod the "old" way, which is what I presume you did here?

Link to comment
Share on other sites

Yup, I discovered the trait icon trick on the old forum after many posts trying to solve it... it's simple but you expect to have to specify one, right (as you do for professions)? Nope, just put the icon file in the right folder and give it the correct name! As long as the icon and trait names match, it works. :)

 

Correct me if I'm wrong, but 2.9.9.17 has a bug in the mod loader that prevents item mods working... though they should work if you install a mod the "old" way, which is what I presume you did here?

Yeah, i made a "Mods" folder in the media folder(s). Works like a charm.

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