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

Leak

Status
Not open for further replies.
Level 7
Joined
Feb 23, 2020
Messages
253
Would this eventually leak if i have up to 100 waves? If so, how do i fix that? :)

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • WaveCount Equal to 1
    • Then - Actions
      • Set VariableSet RandomSpawn = (Random integer number between 1 and 13)
      • Unit - Create 15 Troll (Level 1-3) for Player 12 (Brown) at (Center of Region[RandomSpawn]) facing Default building facing degrees
      • Unit - Create 15 Troll Warrior (Level 1-3) for Player 12 (Brown) at (Center of Region[RandomSpawn]) facing Default building facing degrees
    • Else - Actions
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,191
Yes it leaks 2 locations each time it is executed.

The locations can be easily fixed by creating a point array to replace Region. At map initialization one can load the point array with center of Region point objects. One can then use the point array to crate the units at avoiding the need to create a new point object each time. Since the same point objects get reused, there is no leak and no need to call RemoveLocation.
 
Level 7
Joined
Feb 23, 2020
Messages
253
Yes it leaks 2 locations each time it is executed.

The locations can be easily fixed by creating a point array to replace Region. At map initialization one can load the point array with center of Region point objects. One can then use the point array to crate the units at avoiding the need to create a new point object each time. Since the same point objects get reused, there is no leak and no need to call RemoveLocation.

Sorry for not understanding so well, when it comes to removing locations with arrays i get confused

  • Random RegionSetup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set VariableSet Region[1] = Region 000 <gen>
      • Set VariableSet Region[2] = Region 001 <gen>
      • Set VariableSet Region[3] = Region 002 <gen>
      • Set VariableSet Region[4] = Region 003 <gen>
      • Set VariableSet Region[5] = Region 004 <gen>
      • Set VariableSet Region[6] = Region 005 <gen>
      • Set VariableSet Region[7] = Region 006 <gen>
      • Set VariableSet Region[8] = Region 007 <gen>
      • Set VariableSet Region[9] = Region 008 <gen>
      • Set VariableSet Region[10] = Region 009 <gen>
      • Set VariableSet Region[11] = Region 010 <gen>
      • Set VariableSet Region[12] = Region 011 <gen>
      • Set VariableSet Region[13] = Region 012 <gen>
This is my region int. So, the spawn location is Region[RandomSpawn]. How exactly should i do this to make it not leak?
Could i just change it to point instead of region, then make a "call RemoveLocation(udg_Region[RandomSpawn])?
 
Last edited:
Status
Not open for further replies.
Top