• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Why does this leak and cause game to slow down?

Status
Not open for further replies.
Level 3
Joined
May 24, 2012
Messages
57
Have been messing around with that and after about 4 minutes of gameplay it quits functioning properly and causes game to lag to the point of nearly crashing. Eventually i want 10 levels of this trigger with the limit on the walls being up to 250. Any help is appreciated thanks in advance!

  • TestLimitWalls
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • Unit Group - Pick every unit in (Units owned by (Player((Integer A))) of type Wall Level 1) and do (Actions)
            • Loop - Actions
              • Custom script: set bj_wantDestroyGroup = true
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in (Units owned by (Player((Integer A))) of type Wall Level 1)) Greater than or equal to 30
                  • TownHallTechLevel Equal to 1
                • Then - Actions
                  • Player - Make Wall Level 1 Unavailable for training/construction by (Player((Integer A)))
                • Else - Actions
                  • Player - Make Wall Level 1 Available for training/construction by (Player((Integer A)))
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Number of units in (Units owned by (Player((Integer A))) of type Wall Level 1)) Greater than or equal to 60
                      • TownHallTechLevel Equal to 2
                    • Then - Actions
                      • Player - Make Wall Level 1 Unavailable for training/construction by (Player((Integer A)))
                    • Else - Actions
                      • Player - Make Wall Level 1 Available for training/construction by (Player((Integer A)))
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Number of units in (Units owned by (Player((Integer A))) of type Wall Level 1)) Greater than or equal to 90
                          • TownHallTechLevel Equal to 3
                        • Then - Actions
                          • Player - Make Wall Level 1 Unavailable for training/construction by (Player((Integer A)))
                        • Else - Actions
                          • Player - Make Wall Level 1 Available for training/construction by (Player((Integer A)))
 
Use set bj_wantDestroyGroup = true before you make "Pick Every Unit...".

Never use "Pick every Unit... of Type" ... these "of type" -groups will always leak.

The best would be each time a player creates a Wall, you increase Counter[PlayerNumber] by 1.

Then in your loop you compare "If Counter[LoopIndex] == 30 then" ... and so on.

Use your own custom integer for loops. Integer A/B are less efficient.

You can readup about memory leaks in a tutorial. You will find link in my signature.
 
Level 3
Joined
May 24, 2012
Messages
57
Thanks for the tips. I'm still at beginner level editing on WC3 Editor, though I've been using it on and off for years now (haven't made much progress even with tutorial help). Took my like 9 months to finally figure out how to make a multiboard without copy and pasting other people :/. I've been trying to do what you said about the custom variables rather than using Integer A etc and I just cant get it to even function let alone do anything at all, probably because i'm not using the right variables or something though.
 
Level 25
Joined
May 11, 2007
Messages
4,650
Instead of using Custom script: set bj_wantDestroyGroup = true, save the groups in variables and clear them afterwards? (tempgroup1, etc). It may make it easier to clear groups, etc for you.
 
Level 3
Joined
May 24, 2012
Messages
57
Thanks for the link Deathismyfriend is helping out already! Haven't had any luck getting this trigger to work but the link has helped me out already on a couple other maps i've made with fixing leaky triggers and some of them are running incredibly smooth now.
 
Status
Not open for further replies.
Top