Does it leak?

simonake

New Member
Reaction score
72
I created a Unit spawn and i wanted to know if the locations leaks. I use the same locations each seconds and they're set at the map initialization. Triggers

zSpawn_UnitType = Unit Type Variable
zTempSpawnPoint = The Location
Trigger:
  • Spawning
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 8, do (Actions)
        • Loop - Actions
          • Unit - Create 1 zSpawn_UnitType for Player 12 (Brown) at zTempSpawnPoint[(Integer A)] facing 0.00 degrees
 

naughty

New Member
Reaction score
12
no, it doesn't leak but i'm curios why don't u just make create 8 units instead for each integer from 1 to 8?

woops, my mistake i didn't saw that your location is Array. nvm. it doesn't leak
 

jig7c

Stop reading me...-statement
Reaction score
123
im curious to know how did you setup your location in the map init trigger...
can you post please...
 

Sneakster

Active Member
Reaction score
24
Wouldn't you have to have:
Code:
Custom Script call RemoveLocation (udg_zTempSpawnPoint[1])
Custom Script call RemoveLocation (udg_zTempSpawnPoint[2])
Custom Script call RemoveLocation (udg_zTempSpawnPoint[3])
Custom Script call RemoveLocation (udg_zTempSpawnPoint[4])
Custom Script call RemoveLocation (udg_zTempSpawnPoint[5])
Custom Script call RemoveLocation (udg_zTempSpawnPoint[6])
Custom Script call RemoveLocation (udg_zTempSpawnPoint[7])
Custom Script call RemoveLocation (udg_zTempSpawnPoint[8])

to make it leakless??
 

Komaqtion

You can change this now in User CP.
Reaction score
469
No don't remove the location, since it's every second either create the locations each time, or just let them be... this will leak, but only one time ;)
 

Renendaru

(Evol)ution is nothing without love.
Reaction score
309
Afaik, a loop should be faster, but I have been away from GUI for awhile. I'm certain in Jass loops are faster then CnP.
 

Komaqtion

You can change this now in User CP.
Reaction score
469
I pretty sure this action creates a loop, either way:
Trigger:
  • Unit - Create 1 zSpawn_UnitType for Player 12 (Brown) at zTempSpawnPoint[(Integer A)] facing 0.00 degrees


JASS:
function CreateNUnitsAtLoc takes integer count, integer unitId, player whichPlayer, location loc, real face returns group
    call GroupClear(bj_lastCreatedGroup)
    loop
        set count = count - 1
        exitwhen count < 0
        call CreateUnitAtLocSaveLast(whichPlayer, unitId, loc, face)
        call GroupAddUnit(bj_lastCreatedGroup, bj_lastCreatedUnit)
    endloop
    return bj_lastCreatedGroup
endfunction


That's the converted function, and it creates a loop, so if you use a GUI loop then use a JASS function to create the units then it's even more efficient ;)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top