[snippet] RefreshUI

Scripts

13 years
edited 8 years
Sometimes the unit interface needs to be refreshed in order to be displayed correctly.

For example, try to change the xp of an unit like every 0.05 s without refreshing the ui, and with it.

Code (jass) Select
1
library RefreshUI
2
3
    globals
4
        // just make sure you define an ability which will be never used
5
        private constant integer DUMMY_ABILITY = 'AImo'
6
    endglobals
7
8
    function RefreshUI takes unit u returns nothing
9
        call UnitAddAbility(u,DUMMY_ABILITY)
10
        call UnitRemoveAbility(u,DUMMY_ABILITY)
11
    endfunction
12
13
endlibrary
13 years
Nice snippet.

I remember I used to have those problems and someone told me to kill a unit to refresh the UI. iirc it worked, but it was a long time before I found out I could simply do this. :P
13 years
So you mean that if i kill a random unit every units' UI are refreshed ?!
13 years
Approved, this is an awesome snippet because it's short and sweet :D