• 💀 Happy Halloween! 💀 It's time to vote for the best terrain! Check out the entries to Hive's HD Terrain Contest #2 - Vampire Folklore.❗️Poll closes on November 14, 2023. 🔗Click here to cast your vote!
  • 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 HD Level Design Contest #1 is OPEN! Contestants must create a maze with at least one entry point, and at least one exit point. The map should be made in HD mode, and should not be openable in SD. Only custom models from Hive's HD model and texture sections are allowed. The only exceptions are DNC models and omnilights. This is mainly a visual and design oriented contest, not technical. The UI and video walkthrough rules are there to give everyone an equal shot at victory by standardizing how viewers see the terrain. 🔗Click here to enter!

Em I using variables wrong?

Not open for further replies.
Level 3
Nov 12, 2018
I just want to know, if I'm currently making a mistake, or if I can keep going as I do. My problem (maybe):
I use a couple of variables (udg_) in almost all of my triggers. Stuff like temporary locations, units, groups... I properly remove/destroy them after use, but I'm still worried, that this habbit will cause bugs later on. Do you guys see or know about any problems with this method?

I could imagine, that a trigger might use wrong information stored in a variable, because it was set befor in another trigger and not destroyed/removed in between. Or is EVERY trigger in Wc3 executed one after another and never simultaneously?

Should I get used to work with locals instead? (if there is a problem)
Level 22
Sep 24, 2005
I remember that it is a pre-emptive system... So it would execute code one after another. The problem, if you use global variables, is if a thread gets executed while your code's thread hasn't finished yet and the variable you are using is also used in that newly spawned thread, then the value stored might get overwritten by the spawned thread... I'm too rusty with this so I'm sorry that I couldn't explain it any better. If you don't need the data to be accessible outside the function block you are using it, then I'd say use a local one.

EDIT: Clarified
Last edited:


Spell Reviewer
Level 4
Nov 18, 2012
Really depends how you use them, you can have waits and still variables function properly, and yes actions are executed one after another really fast because if it was simultaneously then....it would be stupid and give a lot of crappy errors lol
Not open for further replies.