Eggon Posted November 21, 2020 Share Posted November 21, 2020 (edited) 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 November 21, 2020 by Eggon Link to comment Share on other sites More sharing options...
EnigmaGrey Posted November 21, 2020 Share Posted November 21, 2020 It pulls data from the scripts on load, so no, that should not be the expected behavior. Link to comment Share on other sites More sharing options...
Eggon Posted November 21, 2020 Author Share Posted November 21, 2020 @EnigmaGreyI'm sorry but your answer is a bit ambiguous - what "it" pulls data from scripts on load? What's the purpose of setTexture / Tooltip if its not permanent? Other setters do update properties permanently, so it is inconsistent. Link to comment Share on other sites More sharing options...
EnigmaGrey Posted November 21, 2020 Share Posted November 21, 2020 Unlike something like weapon damage, these values aren’t saved out into a file; they’re only loaded from the game’s item and translation scripts. They’re used by the engine to create the items moreso than meant to customize items at runtime. Link to comment Share on other sites More sharing options...
Eggon Posted November 21, 2020 Author Share Posted November 21, 2020 @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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now