• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • The Hive's 34th Texturing Contest: Void is now concluded, time to vote for your favourite set of icons! Click here to vote!

[Trigger] Differences with/without variables

Status
Not open for further replies.

sPy

sPy

Level 22
Joined
Apr 10, 2009
Messages
380
Solved

So, I was wondering..What is the difference is set variable in a trigger and not setting it. here's what I meant:

  • Events
    • Unit - A unit dies
  • Conditions
  • Actions
    • Set TheUnit = Triggering Unit
    • Unit - Kill TheUnit
  • Events
    • Unit - A unit dies
    • Conditions
    • Actions
      • Unit - Kill Triggering Unit
I don't think any of them leaks...But I'm not sure whether it affects gameplay perfomance..So, what do you guys think the differences between these two?
 
Last edited:
Level 5
Joined
Oct 14, 2010
Messages
100
If you use (triggering unit) many times in your trigger then using a variable will be faster.
If you use (wait) action, you must use triggering unit after the wait action because if the trigger runs again, your variable might be overwritten.
 
Level 9
Joined
Oct 11, 2009
Messages
477
Don't use Triggering Unit or Attacking Unit after the wait action. Those can bug because if the same event happens again, the internal-game variables are reset and you get hosed. Better learn some multi-instanciable tactics.


Yep, that is not true. The 'Triggering Unit' cannot be overwritten like local variables do.
 
Status
Not open for further replies.
Top