Fluxistence Posted May 13, 2019 Share Posted May 13, 2019 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 More sharing options...
Ultroman Posted May 13, 2019 Share Posted May 13, 2019 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 More sharing options...
Fluxistence Posted May 13, 2019 Author Share Posted May 13, 2019 Ugh, I don't know what's wrong with me lately. >_< I went over all the code in armor.lua searching for a function to modify the armor durability and somehow I missed that one. I only saw TakeDamage. Thanks. =\ Link to comment Share on other sites More sharing options...
Ultroman Posted May 13, 2019 Share Posted May 13, 2019 You're welcome We all miss obvious things sometimes. You fixed it by asking your peers. That's part of growing, m8 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