• 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.

[Solved] Massive Lags

Status
Not open for further replies.
Level 12
Joined
May 20, 2009
Messages
822
  • Summons Aura
    • Events
      • Time - Every 0.33 seconds of game time
    • Conditions
    • Actions
      • For each (Integer SG_Int[1]) from 1 to SG_Inx, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (SG_Unit[SG_Int[1]] has buff Summons Aura ) Equal to True
            • Then - Actions
              • For each (Integer CL_Int) from 1 to CorpseLordIndex, do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Owner of CorpseLord[CL_Int]) Equal to (Owner of SG_Unit[SG_Int[1]])
                    • Then - Actions
                      • Unit - Add Summons Aura Buffs to SG_Unit[SG_Int[1]]
                      • Unit - Set level of Armor Bonus (Summons) for SG_Unit[SG_Int[1]] to (Level of Summons Aura for CorpseLord[CL_Int])
                      • Unit - Set level of Move Speed Bonus (Summons) for SG_Unit[SG_Int[1]] to (Level of Summons Aura for CorpseLord[CL_Int])
                      • Unit - Set level of Spell Damage Reduction for SG_Unit[SG_Int[1]] to (Level of Summons Aura for CorpseLord[CL_Int])
                    • Else - Actions
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (SG_Unit[SG_Int[1]] has buff Summons Aura ) Equal to False
                • Then - Actions
                  • Unit - Remove Armor Bonus (Summons) from SG_Unit[SG_Int[1]]
                  • Unit - Remove Move Speed Bonus (Summons) from SG_Unit[SG_Int[1]]
                  • Unit - Remove Spell Damage Reduction from SG_Unit[SG_Int[1]]
                  • Unit - Remove Summons Aura Buffs from SG_Unit[SG_Int[1]]
                • Else - Actions
I can't find it, but somewhere in here is a massive leak that exponentially decreases performance. Can anyone else see it? (This does function, it just causes lag.)

EDIT: My problem was with my debug text. I had a text message I sent inside of the second loop which was inside of the first one. So it would send (number of summoned units*number of corpse lords) messages per summoned unit every 0.33 seconds. Just for 12 summoned units, that would be sending up to 144 messages every 0.33 seconds, or 432 every second. If it isn't obvious, that would clearly cause some lag.
 
Last edited:
Level 19
Joined
Jul 2, 2011
Messages
2,161
it's your for loop. it's triggering with the event time laps. which results in a never ending loop.

solution

everytime the trigger is started, you stop the trig until the function is completed and then start it again. this stops the trig from running again while it's already running
 
Level 12
Joined
May 20, 2009
Messages
822
It was a combination of things. As I still had my Debug text in there once I posted this, that was causing the majority of it - it was spamming that text multiple times for every unit, 1 for each unit per unit - At 12 that is spamming text 144 times x 3 times a second = 432 messages a second. That could definitely cause some lag.

What you mention is probably also an issue, but a lighter one. That could be easily fixed by just putting a "Turn Off This Trigger" right at the top than turning it back on right at the bottom.

EDIT: There's another problem, it seems to only work when it wants to.
 
Level 19
Joined
Jul 2, 2011
Messages
2,161
only when it wants to hey?

perhaps you should write an order string message. when ever an order is given, a message of that order is written out on screen. that way you know if the ability has been acknowledged as being triggered

thus your trigger is triggered
 
Level 12
Joined
May 20, 2009
Messages
822
I'm purely checking if there's a buff on these units. These units are added to a unit group immediately upon being added to the map, based on certain conditions. (Basically if they're a summoned unit)

EDIT: It was because of the Spellbook I'm using. I actually had no idea "Maximum" and "Minimum" Spells actually did anything. Huh. Put the minimum to 3, and now they're all working properly.
 
Level 24
Joined
Aug 1, 2013
Messages
4,658
everytime the trigger is started, you stop the trig until the function is completed and then start it again. this stops the trig from running again while it's already running

Do you even know how it works?

Remove the "Trigger - Turn off (This trigger)" if you have it.
If you would understand how triggers work, then you can realize that there is no possible situation where this trigger can ever run multiple times at the same moment... no matter how you run it.
 
Level 12
Joined
May 20, 2009
Messages
822
Changed the title to "Massive Lags".

I can't spot anything that can leak.
Try to print the integers to see if they are correct.
Look also if an other trigger might cause the problem,
and maybe it's one in combination with this one.

The problem was a combination of a couple issues, one of which I had explained already: The way I had the trigger set up it was sending large amounts of text messages every second, and for just 12 units being affected by the Aura it would be sending 144 messages 3 times a second every second.

I removed my debug text and that removed virtually all lag. I had taken it out of the trigger I posted here just so it looked cleaner, so that's why you don't see it there.

As for the other issue, it was a problem with my data and not my triggers.
 
Last edited:
Status
Not open for further replies.
Top