Jump to content

How to Refresh Inventory Item Percentage

Recommended Posts

I have some code that updates the durability of an armor (repairs it) in a timed task.
It works, but the durability percentage only updates if I unequip it or equip it again.
How do I get the item slot to refresh its state?

... Well, actually, I did get this to work by piggybacking on the "fueled" component's event:

inst:PushEvent("percentusedchange", { percent = inst.components.armor:GetPercent() })

But that looks like an underhanded trick that only works since the ItemTile widget calls the same SetPercent function for both and doesn't look very closely at the inventory item that pushed the event.
I'd be happier if I could just call a "refresh inventory bar" function or something of the same ilk.

Thanks in advance. =)

Link to comment
Share on other sites

Using Armor:SetCondition or any of the functions of the armor which make use of that function, should automatically update the inventory tile, since it itself pushes the event "percentusedchange". How are you changing the durability of the armor, if not by using any of these functions?

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