• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Will "unit"'s variable leaking?

Status
Not open for further replies.
Level 11
Joined
Oct 20, 2007
Messages
342
udg_Temp_unit = unit

trigger 1
set Temp_unit = Triggering Unit
- then do some action -

should is clear the Temp_unit like:
"Temp_unit = No unit "??


assuming i have 100 unit in a unit variable with array
like :
for loop integer A 1 to 100
set Temp_unit[integer A] = random unit in unit group

will this have a huge leak??? because i'm set the variable into many of unit.
 
Level 8
Joined
Dec 8, 2007
Messages
312
is there a wait command between your action?
If you don't plan to use wait you can make a TEMP_GROUP variable and use
pick random N units from OTHER_GROUP
do all action to picked unit and remove both unit groups.
 
Level 8
Joined
Dec 8, 2007
Messages
312
you mean like this?
action with 100 units
wait
action with another 100 unit
wait
... so on

Then you can still do the trigger with 2 groups
Make ALL_UNITS group and TEMP_UNITS group
in ALL_UNITS place all possible units that can be later placed in Temp group.
Pick 100 random units from ALL_UNITS and place them in TEMP_UNITS. then do you actions. destroy the groups before wait action.
After the wait pick another 100 units from ALL to TEMP and do action then destroy the temp group.
ALL_UNITS group must be destroyed only at the end of the trigger
 
Status
Not open for further replies.
Top