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

Need help with leaks!

Status
Not open for further replies.
Level 3
Joined
Mar 27, 2009
Messages
30
If i in one trigger add units to a unitgroup and in another one take those units and do something. I can't put them in the same trigger. Any way to fix leaks (if there is any)? examples:

1st trigger
Add dying unit to RevivableUnits

2nd trigger
Pick every unit in RevivableUnits and do...


Hope you can help!
 
Level 3
Joined
Mar 27, 2009
Messages
30
It's for an AoS. It's supposed to keep all reviveable heroes so it can't be removed (i think) Altho after a while it might add to alot of leaks making laggy gameplay. If there's a way then plz let me know! :D
 
Level 3
Joined
Mar 27, 2009
Messages
30
The thing with this is that it will almost always contain units, even after the trigger has been executed. As far as i know that suggestion of yours will remove the rest of the heroes in the group too. Maybe add something like

If RevivableHeroes = empty
then
Remove group (leak)
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Why do you need to clear the group? Adding units to a group does not leak. And neither does looping through a group stored in a global (actually this does leak but there's nothing you can do about it in GUI).

If it's for an AoE spell, I think he needs to have an empty group before starting the spell, that's where the GroupClear() comes in.
(boolexpr, huh? :/).
 
Level 3
Joined
Mar 27, 2009
Messages
30
If it's for an AoE spell, I think he needs to have an empty group before starting the spell, that's where the GroupClear() comes in.
(boolexpr, huh? :/).

You got it wrong there. I prbly didn't explain enough. It's for reviving the heroes, and possibly to make like a team reincarnation for a skill, or something else. The triggers can be made ether in gui or if neceserry in JASS. And you don't have to care about <empty string> bcs i'm too lazy to remove that atm, will do so later.
Also please check for any other leaks if i have missed them :D

  • Herorevive
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Dying unit) is A Hero) Equal to True
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Add (Dying unit) to RevivableHeroes
      • Set TempReal = (((Real((Hero level of (Dying unit)))) x 3.50) + 5.00)
      • Countdown Timer - Start ReviveTimers[(Player number of (Owner of (Dying unit)))] as a One-shot timer that will expire in TempReal seconds
      • Game - Display to (Player group((Owner of (Dying unit)))) for 4.00 seconds the text: (Your hero will revive in + (((String((TempReal + 5.00))) + <Empty String>) + seconds.))

  • Revive Hero Timer
    • Events
      • Time - ReviveTimers[1] expires
      • Time - ReviveTimers[2] expires
      • Time - ReviveTimers[3] expires
      • Time - ReviveTimers[4] expires
      • Time - ReviveTimers[5] expires
      • Time - ReviveTimers[6] expires
      • Time - ReviveTimers[8] expires
      • Time - ReviveTimers[9] expires
      • Time - ReviveTimers[10] expires
      • Time - ReviveTimers[11] expires
      • Time - ReviveTimers[12] expires
    • Conditions
    • Actions
      • Unit Group - Pick every unit in RevivableHeroes and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Remaining time for ReviveTimers[(Player number of (Owner of (Picked unit)))]) Less than 1.00
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Owner of (Picked unit)) is in (All allies of Player 1 (Red))) Equal to True
                • Then - Actions
                  • Hero - Instantly revive (Picked unit) at (Center of HuHQ <gen>), Show revival graphics
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Owner of (Picked unit)) is in (All allies of Player 4 (Purple))) Equal to True
                    • Then - Actions
                      • Hero - Instantly revive (Picked unit) at (Center of OrcHQ <gen>), Show revival graphics
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • ((Owner of (Picked unit)) is in (All allies of Player 7 (Green))) Equal to True
                        • Then - Actions
                          • Hero - Instantly revive (Picked unit) at (Center of UdHQ <gen>), Show revival graphics
                        • Else - Actions
                          • Hero - Instantly revive (Picked unit) at (Center of NeHQ <gen>), Show revival graphics
            • Else - Actions
      • Selection - Select (Triggering unit) for (Owner of (Triggering unit))
      • Camera - Pan camera for (Owner of (Triggering unit)) to (Position of (Triggering unit)) over 0.60 seconds
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
Why do you need to clear the group? Adding units to a group does not leak. And neither does looping through a group stored in a global (actually this does leak but there's nothing you can do about it in GUI).

It's better to recycle the same group than to constantly create and destroy them. Some leaks (that are out of your control) occur if you destroy a group after it has enumerated units. So regardless of whether you use GUI or jass, clearing / recycling groups is better than destroying them.
 
Status
Not open for further replies.
Top