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

Reducing lag from Loop Actions

Status
Not open for further replies.
Level 2
Joined
Jul 26, 2011
Messages
12
Hello there and thanks for coming by.
I'm pretty much new to "remove leaks" kind a stuff and don't tell me to read about it in forums because I just did for few hours or so. I'm pretty much stuck at the moment and gave up after trying for a quite while.

So to the point;
When I start my map it lags so much that it's impossible to play.
And since I don't quite understand "leak thing" I would like to do the easy way - by someone demonstrating it on this trigger what needs to be done in order to remove any kinds of leak for what so ever.

Thanks :).

  • Weaken Loop
    • Events
      • Time - Every 0.04 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has buff Weaken[1]) Equal to True
            • Then - Actions
              • Unit - Add Weaken (Weaken) 1 to (Picked unit)
            • Else - Actions
              • Unit - Remove Weaken (Weaken) 1 from (Picked unit)
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has buff Weaken[2]) Equal to True
            • Then - Actions
              • Unit - Add Weaken (Weaken) 2 to (Picked unit)
            • Else - Actions
              • Unit - Remove Weaken (Weaken) 2 from (Picked unit)
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has buff Weaken[3]) Equal to True
            • Then - Actions
              • Unit - Add Weaken (Weaken) 3 to (Picked unit)
            • Else - Actions
              • Unit - Remove Weaken (Weaken) 3 from (Picked unit)
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has buff Weaken[4]) Equal to True
            • Then - Actions
              • Unit - Add Weaken (Weaken) 4 to (Picked unit)
            • Else - Actions
              • Unit - Remove Weaken (Weaken) 4 from (Picked unit)
              • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) has buff Weaken[5]) Equal to True
                    • Then - Actions
                      • Unit - Add Weaken (Weaken) 5 to (Picked unit)
                    • Else - Actions
                      • Unit - Remove Weaken (Weaken) 5 from (Picked unit)
  • Weaken Buff Array
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Weaken[1] = Weaken [Level 1]
      • Set Weaken[2] = Weaken [Level 2]
      • Set Weaken[3] = Weaken [Level 3]
      • Set Weaken[4] = Weaken [Level 4]
      • Set Weaken[5] = Weaken [Level 5]
 
Last edited by a moderator:
Level 37
Joined
Mar 6, 2006
Messages
9,240
This is how you destroy the next unit group that is created:

  • Weaken Loop
    • Events
      • Time - Every 0.04 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has buff Weaken[1]) Equal to True
            • Then - Actions
              • Unit - Add Weaken (Weaken) 1 to (Picked unit)
            • Else - Actions
              • Unit - Remove Weaken (Weaken) 1 from (Picked unit)
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has buff Weaken[2]) Equal to True
            • Then - Actions
              • Unit - Add Weaken (Weaken) 2 to (Picked unit)
            • Else - Actions
              • Unit - Remove Weaken (Weaken) 2 from (Picked unit)
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has buff Weaken[3]) Equal to True
            • Then - Actions
              • Unit - Add Weaken (Weaken) 3 to (Picked unit)
            • Else - Actions
              • Unit - Remove Weaken (Weaken) 3 from (Picked unit)
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has buff Weaken[4]) Equal to True
            • Then - Actions
              • Unit - Add Weaken (Weaken) 4 to (Picked unit)
            • Else - Actions
              • Unit - Remove Weaken (Weaken) 4 from (Picked unit)
              • Custom script: set bj_wantDestroyGroup = true
              • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) has buff Weaken[5]) Equal to True
                    • Then - Actions
                      • Unit - Add Weaken (Weaken) 5 to (Picked unit)
                    • Else - Actions
                      • Unit - Remove Weaken (Weaken) 5 from (Picked unit)
  • Weaken Buff Array
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Weaken[1] = Weaken [Level 1]
      • Set Weaken[2] = Weaken [Level 2]
      • Set Weaken[3] = Weaken [Level 3]
      • Set Weaken[4] = Weaken [Level 4]
      • Set Weaken[5] = Weaken [Level 5]
You should only pick the units once.
 
Level 2
Joined
Jul 26, 2011
Messages
12
Hello again and thanks for replying.

1st I tried that Custom script: set bj_wantDestroyGroup = true of yours Maker and it worked perfectly fine thanks for that.
Unfortunately I'm still having massive delay somehow.

2nd Could you watermelon_1234 demonstrate somehow apply
(Level of Weaken (Weaken) X for (Picked unit)) Greater than 0

into this trigger
  • Weaken Loop
  • Events
  • Time - Every 0.04 seconds of game time
  • Conditions
  • Actions
  • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
  • Loop - Actions
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  • If - Conditions
  • ((Picked unit) has buff Weaken[1]) Equal to True
  • Then - Actions
  • Unit - Add Weaken (Weaken) 1 to (Picked unit)
  • Else - Actions
  • Unit - Remove Weaken (Weaken) 1 from (Picked unit)
Would be quite helpful since I'm not quite following you.

Best regards :)
 
Last edited:
Level 14
Joined
Nov 18, 2007
Messages
1,084
  • Weaken Loop
    • Events
      • Time - Every 0.04 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has buff Weaken[1]) Equal to True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of Weaken (Weaken) 1 for (Picked unit)) Equal to 0 // Only add the ability if a buffed unit doesn't have it.
                • Then - Actions
                  • Unit - Add Weaken (Weaken) 1 to (Picked unit)
                • Else - Actions
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of Weaken (Weaken) 1 for (Picked unit)) Greater than 0 // Only remove the ability if an unbuffed unit has the ability.
                • Then - Actions
                  • Unit - Remove Weaken (Weaken) 1 from (Picked unit)
                • Else - Actions
Depending on how Weaken is triggered, this could probably be improved more.

BTW use
  • tags to make it easier to see your triggers. ;D
 
Level 2
Joined
Jul 26, 2011
Messages
12
  • [TRIGGER]DemoTry
    • Events
      • Time - Every 0.06 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has buff Weaken[1]) Equal to True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of Weaken (Weaken) 1 for (Picked unit)) Equal to 0
                • Then - Actions
                  • Unit - Add Weaken (Weaken) 1 to (Picked unit)
                • Else - Actions
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of Weaken (Weaken) 1 for (Picked unit)) Greater than 0
                • Then - Actions
                  • Unit - Remove Weaken (Weaken) 1 from (Picked unit)
                • Else - Actions
                  • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
                    • Loop - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • ((Picked unit) has buff Weaken[2]) Equal to True
                        • Then - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Level of Weaken (Weaken) 2 for (Picked unit)) Equal to 0
                            • Then - Actions
                              • Unit - Add Weaken (Weaken) 2 to (Picked unit)
                            • Else - Actions
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Level of Weaken (Weaken) 2 for (Picked unit)) Greater than 0
                            • Then - Actions
                              • Unit - Remove Weaken (Weaken) 2 from (Picked unit)
                            • Else - Actions
                              • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
                                • Loop - Actions
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • ((Picked unit) has buff Weaken[3]) Equal to True
                                    • Then - Actions
                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                        • If - Conditions
                                          • (Level of Weaken (Weaken) 3 for (Picked unit)) Equal to 0
                                        • Then - Actions
                                          • Unit - Add Weaken (Weaken) 3 to (Picked unit)
                                        • Else - Actions
                                    • Else - Actions
                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                        • If - Conditions
                                          • (Level of Weaken (Weaken) 3 for (Picked unit)) Greater than 0
                                        • Then - Actions
                                          • Unit - Remove Weaken (Weaken) 3 from (Picked unit)
                                        • Else - Actions
                                          • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
                                            • Loop - Actions
                                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                • If - Conditions
                                                  • ((Picked unit) has buff Weaken[4]) Equal to True
                                                • Then - Actions
                                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                    • If - Conditions
                                                      • (Level of Weaken (Weaken) 4 for (Picked unit)) Equal to 0
                                                    • Then - Actions
                                                      • Unit - Add Weaken (Weaken) 4 to (Picked unit)
                                                    • Else - Actions
                                                • Else - Actions
                                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                    • If - Conditions
                                                      • (Level of Weaken (Weaken) 4 for (Picked unit)) Greater than 0
                                                    • Then - Actions
                                                      • Unit - Remove Weaken (Weaken) 4 from (Picked unit)
                                                    • Else - Actions
                                                      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
                                                        • Loop - Actions
                                                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                            • If - Conditions
                                                              • ((Picked unit) has buff Weaken[5]) Equal to True
                                                            • Then - Actions
                                                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                                • If - Conditions
                                                                  • (Level of Weaken (Weaken) 5 for (Picked unit)) Equal to 0
                                                                • Then - Actions
                                                                  • Unit - Add Weaken (Weaken) 5 to (Picked unit)
                                                                • Else - Actions
                                                            • Else - Actions
                                                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                                • If - Conditions
                                                                  • (Level of Weaken (Weaken) 5 for (Picked unit)) Greater than 0
                                                                • Then - Actions
                                                                  • Unit - Remove Weaken (Weaken) 5 from (Picked unit)
                                                                • Else - Actions[TRIGGER]
[/TRIGGER]

Hm nothing works just keep receiving massive delay=((((((((((

I guess I'll just stick with what i did before starting this thread.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,201
What sort of lag are you talking about?
Frame skip (where the screen freezes)
or lag (where responeses get delayed due to net traffic)

As I mentioned already, you are using a combination of control and command coupling in your system. The result is something stupidly unreadable and inefficient.

Instead, try using an ability with multiple levels instead of many different abilities. If that is not possible, consider mapping the abilities via some form of hashtable system.
 
Level 6
Joined
Jun 24, 2011
Messages
176
I totally agree to that above, by the way, why would you use differnt abilities for the same effect, just consider using an ability with more than one level.

Edit: Ah missed to hit the send message button and now Super Good answered before me xD
 
Last edited:
Level 2
Joined
Jul 26, 2011
Messages
12
Hm yeah I guess you guys are right.. Well the simply answer to that is I'm pretty much incompetent
Could you guys post a trigger on how you think it should be done?
That would be appreciated :)

I simple don't know how to set "buff level" for instance I can set an ability to desired level but not when it comes to buff..

Oh yeah almost forgot - that delay thing i mentioned is something like - it gets impossible to move around screen with the mouse. You cant do anything but force quit it trough task manager.
 

Deleted member 177737

D

Deleted member 177737

I think what your talking about is the game crashing.
 
Status
Not open for further replies.
Top