vJASS & Zinc Documentation
For the latest documentation about how it works vJASS and Zinc language layers for Warcraft III, please follow these links:
Jasshelper documentation - Zinc documentation - WC3 Optimizer documentation

[snippet] RefreshUI

Troll-Brain · 10706

0 Members and 1 Guest are viewing this topic.

[snippet] RefreshUI
on: September 13, 2012, 05:26:57 PM
Category: Interface
Language: vJASS

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
  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
« Last Edit: December 19, 2017, 01:33:38 PM by moyack »

vJass is already a jass preprocessor, no need to (ab)use vJass features in order to make some inferior vJass preprocessor coded "by hand".


Re: RefreshUI
Reply #1 on: September 13, 2012, 07:29:32 PM

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



Re: RefreshUI
Reply #2 on: September 14, 2012, 06:14:05 AM

So you mean that if i kill a random unit every units' UI are refreshed ?!

vJass is already a jass preprocessor, no need to (ab)use vJass features in order to make some inferior vJass preprocessor coded "by hand".


Re: RefreshUI
Reply #3 on: September 15, 2012, 10:06:31 PM

After some time, I digged around and found it:
http://www.thehelper.net/threads/update-ability-tooltip.57197/

But apparently it is also unit specific, so no it is not better in any way. :P



Re: RefreshUI
Reply #4 on: September 17, 2012, 06:32:42 AM

Approved, this is an awesome snippet because it's short and sweet :D



 

Power of Corruption - A Warcraft III altered melee map   Chaos Realm - The world of Game modders and wc3 addicts     WC3JASS.com - The JASS Vault   Jetcraft - A Starcraft II mod