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

whats best point leak removal?

Status
Not open for further replies.
Level 13
Joined
Mar 24, 2010
Messages
950
so i always thought its best to set the point and then runa loop using it like this:

  • Set TempSpawnPoint = (Center point in SpawnRegion)
  • For each (Integer A) from 1 to players, do (Actions)
    • Loop - Actions
      • Unit - Create 1 SpawnUnitType for Player 11 (Dark Green) at TempSpawnPoint facing PointWorldTree
  • Custom script: call RemoveLocation( udg_TempSpawnPoint )
But i see alot of people do it this way.. It just seems like this is not as efficient. Why set the point more than once if not needed?

  • For each (Integer A) from 1 to players, do (Actions)
    • Loop - Actions
      • Set TempSpawnPoint = (Center point in SpawnRegion)
      • Unit - Create 1 SpawnUnitType for Player 11 (Dark Green) at TempSpawnPoint facing PointWorldTree
      • Custom script: call RemoveLocation( udg_TempSpawnPoint )
 
Last edited:
From what I can tell it is pretty much the same, but the second version seems to be faster.
 
I second the post above. Actually, if your point is static and it will remain the same for the rest of the game you only need to set it at start and forget of Removing it. 2nd trigger is more dynamical because of Maker said.

Both remove leaks efficiently anyways.
 
Sorry my bad i didnt mean to have (Random point in SpawnRegion) in my example lol xD

i edited it now to what i meant, "Centered." just 1 point all units to same point for both.

I know it has to be more efficient to do it the first way as the loop doesn't have to execute 2 more lines of code. I just wonder why thats how i see most everyone do it.. lol

also what if you dont want to bother removing 1 point leak lets say the center point of playable map area. If you use that point in alot of triggers will it leak each time or does it only leak once since it is the same point each time?
 
Since you want every unit to spawn on a specific point, you don't have to declare the variable within the loop. Leave it out of it. Random point would result a whole new point, while center of region results a specific point.

For your new question, no, it leaks once, it's the trigger within which the variable's value is defined, but it is recommended that you set it and remove it whenever you are using it.
 
Status
Not open for further replies.
Back
Top