• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your 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:
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