Warcraft III: MapsModelsSkinsIconsSpellsToolsTutorials
WC3 JASS: Code SnippetsJASS and vJASS Spells and SystemsJass Tutorials
Chat @Discord

Author Topic: [snippet] RefreshUI  (Read 9464 times)

  • Rookie - level 1
  • *
  • Posts: 48
  • WC3 Skins: 0
  • WC3 Icons: 0
  • WC3 Spells: 0
  • WC3 Models: 0
  • WC3 Tutorials: 0
  • WC3 Tools: 0
  • WC3 Maps: 0
  • Reputation: 8
  • cool != useful
    • View Profile
[snippet] RefreshUI
« on: September 13, 2012, 05:26:57 PM »
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
« Last Edit: December 29, 2012, 07:09:35 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".

  • Rookie - level 1
  • *
  • Posts: 41
  • WC3 Skins: 0
  • WC3 Icons: 0
  • WC3 Spells: 0
  • WC3 Models: 0
  • WC3 Tutorials: 0
  • WC3 Tools: 0
  • WC3 Maps: 0
  • Reputation: 13
    • View Profile
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

  • Rookie - level 1
  • *
  • Posts: 48
  • WC3 Skins: 0
  • WC3 Icons: 0
  • WC3 Spells: 0
  • WC3 Models: 0
  • WC3 Tutorials: 0
  • WC3 Tools: 0
  • WC3 Maps: 0
  • Reputation: 8
  • cool != useful
    • View Profile
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".

  • Rookie - level 1
  • *
  • Posts: 41
  • WC3 Skins: 0
  • WC3 Icons: 0
  • WC3 Spells: 0
  • WC3 Models: 0
  • WC3 Tutorials: 0
  • WC3 Tools: 0
  • WC3 Maps: 0
  • Reputation: 13
    • View Profile
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

  • Awesome Global Code Moderator
  • Recognized User
  • Rookie - level 2
  • *
  • Posts: 83
  • WC3 Skins: 0
  • WC3 Icons: 0
  • WC3 Spells: 0
  • WC3 Models: 0
  • WC3 Tutorials: 0
  • WC3 Tools: 0
  • WC3 Maps: 0
  • Reputation: 516
  • vJass Incarnate
    • View Profile
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

 

[Snippet] Group Units in line, with distance and optional spread-value

Started by rvonsonsnadtzBoard Codes & Snippets

Replies: 5
Views: 11617
Last post March 13, 2013, 06:52:16 PM
by rvonsonsnadtz
[Snippet] Single Player Detector

Started by moyackBoard Codes & Snippets

Replies: 12
Views: 21235
Last post March 13, 2013, 12:48:49 PM
by Magtheridon96
[Snippet] Simple Unit Indexer

Started by moyackBoard Codes & Snippets

Replies: 17
Views: 26150
Last post September 30, 2013, 08:07:19 AM
by moyack
[Snippet] Disable Transmission Skip

Started by PurgeandfireBoard Codes & Snippets

Replies: 2
Views: 8858
Last post July 02, 2013, 01:34:55 PM
by Purgeandfire
[Snippet] Timed Effects

Started by moyackBoard Codes & Snippets

Replies: 0
Views: 7560
Last post January 09, 2012, 07:03:32 PM
by moyack
Blizzard Modding Information Center Starcraft II Modding Information Center Wacraft III Modding Information Center WC3JASS.com - The JASS Vault Chronicles of Darkness - A Warcraft III mod Jetcraft - A Starcraft II mod Troll Smash - A Warcraft III Arena
  Mod DB - Change the Game Power of Corruption - A Warcraft III altered melee map Chaos Realm - The world of Game modders and wc3 addicts Follow us on Facebook!!