• 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.

[Solved] What to use Triggering unit or Unit in variable

Status
Not open for further replies.
Level 5
Joined
Aug 12, 2010
Messages
87
What to use and if its any difference, leaks?

  • Set Unitsss = (Triggering unit)
  • Set Pointsss = (Position of (Triggering unit))
  • Set Unitsss = (Triggering unit)
  • Set Pointsss = (Position of Unitsss)
I use Unitsss anyway in later loop trigger...so..lol
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
More "()" means more actions/functions = heavier system requirement to work = slower scrips = more FPS.

As you can see,
Set Pointsss = (Position of (Triggering unit))"
has more ()'s than
Set Pointsss = (Position of Unitsss)

Indeed, if you're planning to use something more than once in a trigger (Unit, Point, Region, etc.) is better to save it into a variable and use a variable.

When you use (Triggering Unit) the system has to look for it. If you use 15 times (Triggering Unit) you're looking 15 times for the same unit, in change, If you set (Triggering Unit) into "Units" variable, and then you use "Units" in the triggers instead of (Triggering Unit), the system already knows which unit has to handle, instead of looking for it over and over.

And there's no leak as long as you remove the point after using it or not needing it again.
 
Level 5
Joined
Aug 12, 2010
Messages
87
More "()" means more actions/functions = heavier system requirement to work = slower scrips = more FPS.

As you can see,
Set Pointsss = (Position of (Triggering unit))"
has more ()'s than
Set Pointsss = (Position of Unitsss)

Indeed, if you're planning to use something more than once in a trigger (Unit, Point, Region, etc.) is better to save it into a variable and use a variable.

When you use (Triggering Unit) the system has to look for it. If you use 15 times (Triggering Unit) you're looking 15 times for the same unit, in change, If you set (Triggering Unit) into "Units" variable, and then you use "Units" in the triggers instead of (Triggering Unit), the system already knows which unit has to handle, instead of looking for it over and over.

And there's no leak as long as you remove the point after using it or not needing it again.

Thank you very much!
 
Status
Not open for further replies.
Top