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

[Trigger] Does this leak?

Status
Not open for further replies.
Level 8
Joined
Jul 10, 2018
Messages
383
  • ZeroTwoOneTwo
    • Events
      • Time - Every 60.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area) owned by Player 12 (Brown)) and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Attack-Move To (Center of O42891 <gen>)
 
Level 8
Joined
Jul 10, 2018
Messages
383
Yes, it leaks group and location.
what about this

  • Spawner Units First 1
    • Events
      • Time - Every 10.00 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit - Create 6 Ghoul for Player 21 (Coal) at (Center of Undead Units Spawner 1 <gen>) facing Default building facing degrees
      • Unit - Create 1 Crypt Fiend for Player 21 (Coal) at (Center of Undead Units Spawner 1 <gen>) facing Default building facing degrees
      • Unit Group - Pick every unit in (Units in Undead Units Spawner 1 <gen>) and do (Unit - Order (Picked unit) to Attack-Move To (Center of Attacking Point <gen>))
 
Level 8
Joined
Jul 10, 2018
Messages
383
the center of x positions will still leak, you need to place them in variables then remove them.
so I need to make Variables for region then how to remove them?
like this?
  • Spawners Variables Leakless
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Center[0] = (Center of Undead Units Spawner 1 <gen>)
      • Set Center[1] = (Center of Undead Units Spawner 2 <gen>)
      • Set Center[2] = (Center of Undead Units Spawner 3 <gen>)
      • Set Center[3] = (Center of Undead Units Spawner 4 <gen>)
 
Last edited:
Level 11
Joined
Jul 4, 2016
Messages
627
JASS:
Customscript: call RemoveLocation(Center[1])

Since you are spawning them constantly, you most likely don't want to remove them.
 
Level 8
Joined
Jul 10, 2018
Messages
383
Replacing those center of positions with your variables in your periodic trigger and you will be good to go.
Like this?
  • Spawner Units First 1
    • Events
      • Time - Every 20.00 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit - Create 6 Ghoul for Player 21 (Coal) at Center[0] facing Default building facing degrees
      • Unit - Create 1 Crypt Fiend for Player 21 (Coal) at Center[0] facing Default building facing degrees
      • Unit Group - Pick every unit in (Units in Undead Units Spawner 1 <gen>) and do (Unit - Order (Picked unit) to Attack-Move To (Center of Attacking Point <gen>))
      • Custom script: call RemoveLocation(Center[0])
 
Level 11
Joined
Jul 4, 2016
Messages
627
1. Yes, except you don't need that RemoveLocation because you are constantly spawning them and reusing the same location.


2. Yes, if you want to remove the unit group leak. Alternately, you can use a unit group variable.
 
Level 11
Joined
Jul 4, 2016
Messages
627
You need to do to every unit group action.

On another note, you need to put the bj_wantDestroyGroup = true above the unit group action.
 
Level 11
Joined
Jul 4, 2016
Messages
627
When set to true, it will destroy the group that is created in the unit group action.

JASS:
function ForGroupBJ takes group whichGroup, code callback returns nothing
    // If the user wants the group destroyed, remember that fact and clear
    // the flag, in case it is used again in the callback.
    local boolean wantDestroy = bj_wantDestroyGroup
    set bj_wantDestroyGroup = false

    call ForGroup(whichGroup, callback)

    // If the user wants the group destroyed, do so now.
    if (wantDestroy) then
        call DestroyGroup(whichGroup)
    endif
endfunction

The above script is what that pick every unit does internally.
 
Level 8
Joined
Jul 10, 2018
Messages
383
When set to true, it will destroy the group that is created in the unit group action.

JASS:
function ForGroupBJ takes group whichGroup, code callback returns nothing
    // If the user wants the group destroyed, remember that fact and clear
    // the flag, in case it is used again in the callback.
    local boolean wantDestroy = bj_wantDestroyGroup
    set bj_wantDestroyGroup = false

    call ForGroup(whichGroup, callback)

    // If the user wants the group destroyed, do so now.
    if (wantDestroy) then
        call DestroyGroup(whichGroup)
    endif
endfunction

The above script is what that pick every unit does internally.
Thanks for the good informations! 1+ Rep
 
Level 39
Joined
Feb 27, 2007
Messages
4,990
@Veldris, Bo linked you two very good tutorials that explain literally EVERY possible GUI leak that you can fix. There are examples. There are explanations. There are suggestions. There are guidelines and rules of thumb and a whole host of peer-reviewed commentary on the what/why/how of leaks in that tutorial specifically so that the tutorial is an easily digestible and usable resource for mappers unfamiliar with leaks.


When someone links you a tutorial on a subject that you clearly don’t understand, they’re doing it for your benefit, not so they can be lazy. Please actually read the tutorials, or at least refer to them the next time you have questions about that very topic.
 
Level 8
Joined
Jul 10, 2018
Messages
383
@Veldris, Bo linked you two very good tutorials that explain literally EVERY possible GUI leak that you can fix. There are examples. There are explanations. There are suggestions. There are guidelines and rules of thumb and a whole host of peer-reviewed commentary on the what/why/how of leaks in that tutorial specifically so that the tutorial is an easily digestible and usable resource for mappers unfamiliar with leaks.


When someone links you a tutorial on a subject that you clearly don’t understand, they’re doing it for your benefit, not so they can be lazy. Please actually read the tutorials, or at least refer to them the next time you have questions about that very topic.
I did read them after we solved the issues :D
 
Status
Not open for further replies.
Top