Jump to content

Icons set by setTexture() and tooltips set by setTooltip() do not get preserved on save


Eggon

Recommended Posts

The setTexture() method allows to set new icon to an item in inventory, but that icon is substituted on game reload with "default" icon specifed in scripts/.txt files.  The same applies to tooltip text.

Expected behavior is to have the icon and tooltip text preserved on the particular item.

 

Example code:

local player = getPlayer()
local inventory = player:getInventory()
local item = inventory:getFirstTypeRecurse(itemType)
local texture = getTexture(texturePath)
item:setTexture(texture)
item:setTooltip(toolTipText)

 

Edited by Eggon
Link to comment
Share on other sites

@EnigmaGrey Thank you for explanation. If that is the case could you please recommend how to access all spawned items of a given type on on any of the loading events?

 

I'd loop through them and perform a modification function on all of them that would reinstate the lost values based on values I'd save in getModData().

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