• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece!🔗 Click here to enter!

[Trigger] Differences with/without variables

Status
Not open for further replies.

sPy

sPy

Level 21
Joined
Apr 10, 2009
Messages
268
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