[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:
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.
 
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.
Back
Top