Is this trigger leaking or why is it causing lag

Level 3
Joined
Mar 20, 2011
Messages
35
The trigger is for a spell summoning elementals full details can be seen here(Servants of the Sea)

  • Servants of the Sea
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Servants of the Sea
    • Actions
      • Set ServantsoftheSea_Loc = (Position of (Casting unit))
      • Unit - Cause (Casting unit) to damage (Casting unit), dealing (0.10 x (Max life of (Casting unit))) damage of attack type Chaos and damage type Normal
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Servants of the Sea for (Casting unit)) Equal to 1
        • Then - Actions
          • Unit - Create 1 Lesser Water Elemental (Level 1) for (Owner of (Casting unit)) at ServantsoftheSea_Loc facing Default building facing degrees
          • Unit - Add a 30.00 second Water Elemental expiration timer to (Last created unit)
          • Set Some_Unit = (Last created unit)
          • Set Max_Hp = 150
          • Trigger - Run Set Max Hp <gen> (ignoring conditions)
          • Unit - Create 1 Lesser Water Elemental (Level 1) for (Owner of (Casting unit)) at ServantsoftheSea_Loc facing Default building facing degrees
          • Unit - Add a 30.00 second Water Elemental expiration timer to (Last created unit)
          • Set Some_Unit = (Last created unit)
          • Set Max_Hp = (Integer((0.30 x (Max life of (Casting unit)))))
          • Trigger - Run Set Max Hp <gen> (ignoring conditions)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Servants of the Sea for (Casting unit)) Equal to 2
        • Then - Actions
          • Unit - Create 1 Lesser Water Elemental (Level 2) for (Owner of (Casting unit)) at ServantsoftheSea_Loc facing Default building facing degrees
          • Unit - Add a 30.00 second Water Elemental expiration timer to (Last created unit)
          • Set Max_Hp = (Integer((0.30 x (Max life of (Casting unit)))))
          • Set Some_Unit = (Last created unit)
          • Trigger - Run Set Max Hp <gen> (ignoring conditions)
          • Unit - Create 1 Lesser Water Elemental (Level 2) for (Owner of (Casting unit)) at ServantsoftheSea_Loc facing Default building facing degrees
          • Unit - Add a 30.00 second Water Elemental expiration timer to (Last created unit)
          • Set Max_Hp = (Integer((0.30 x (Max life of (Casting unit)))))
          • Set Some_Unit = (Last created unit)
          • Trigger - Run Set Max Hp <gen> (ignoring conditions)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Servants of the Sea for (Casting unit)) Equal to 3
        • Then - Actions
          • Unit - Create 1 Greater Water Elemental (Level 3) for (Owner of (Casting unit)) at ServantsoftheSea_Loc facing Default building facing degrees
          • Unit - Add a 30.00 second Water Elemental expiration timer to (Last created unit)
          • Set Max_Hp = (Integer((0.40 x (Max life of (Casting unit)))))
          • Set Some_Unit = (Last created unit)
          • Trigger - Run Set Max Hp <gen> (ignoring conditions)
          • Unit - Create 1 Greater Water Elemental (Level 3) for (Owner of (Casting unit)) at ServantsoftheSea_Loc facing Default building facing degrees
          • Unit - Add a 30.00 second Water Elemental expiration timer to (Last created unit)
          • Set Max_Hp = (Integer((0.40 x (Max life of (Casting unit)))))
          • Set Some_Unit = (Last created unit)
          • Trigger - Run Set Max Hp <gen> (ignoring conditions)
          • Unit - Create 1 Greater Water Elemental (Level 3) for (Owner of (Casting unit)) at ServantsoftheSea_Loc facing Default building facing degrees
          • Unit - Add a 30.00 second Water Elemental expiration timer to (Last created unit)
          • Set Max_Hp = (Integer((0.40 x (Max life of (Casting unit)))))
          • Set Some_Unit = (Last created unit)
          • Trigger - Run Set Max Hp <gen> (ignoring conditions)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Servants of the Sea for (Casting unit)) Equal to 4
        • Then - Actions
          • Unit - Create 1 Demigod Water Elemental (Level 4) for (Owner of (Casting unit)) at ServantsoftheSea_Loc facing Default building facing degrees
          • Unit - Add a 30.00 second Water Elemental expiration timer to (Last created unit)
          • Set Max_Hp = (Integer((0.40 x (Max life of (Casting unit)))))
          • Set Some_Unit = (Last created unit)
          • Trigger - Run Set Max Hp <gen> (ignoring conditions)
          • Unit - Create 1 Demigod Water Elemental (Level 4) for (Owner of (Casting unit)) at ServantsoftheSea_Loc facing Default building facing degrees
          • Unit - Add a 30.00 second Water Elemental expiration timer to (Last created unit)
          • Set Max_Hp = (Integer((0.40 x (Max life of (Casting unit)))))
          • Set Some_Unit = (Last created unit)
          • Trigger - Run Set Max Hp <gen> (ignoring conditions)
          • Unit - Create 1 Demigod Water Elemental (Level 4) for (Owner of (Casting unit)) at ServantsoftheSea_Loc facing Default building facing degrees
          • Unit - Add a 30.00 second Water Elemental expiration timer to (Last created unit)
          • Set Max_Hp = (Integer((0.40 x (Max life of (Casting unit)))))
          • Set Some_Unit = (Last created unit)
          • Trigger - Run Set Max Hp <gen> (ignoring conditions)
          • Unit - Create 1 Demigod Water Elemental (Level 4) for (Owner of (Casting unit)) at ServantsoftheSea_Loc facing Default building facing degrees
          • Unit - Add a 30.00 second Water Elemental expiration timer to (Last created unit)
          • Set Max_Hp = (Integer((0.40 x (Max life of (Casting unit)))))
          • Set Some_Unit = (Last created unit)
          • Trigger - Run Set Max Hp <gen> (ignoring conditions)
        • Else - Actions
      • Custom script: call RemoveLocation (udg_ServantsoftheSea_Loc)
This is the Max HP trigger

  • Set Max Hp
    • Events
    • Conditions
    • Actions
      • Set Max_Hp = (Max_Hp - (Integer((Max life of Some_Unit))))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Max_Hp Greater than 0
        • Then - Actions
          • Set Loop_Integer = ((Max_Hp - (Max_Hp mod 100)) / 100)
          • For each (Integer A) from 1 to Loop_Integer, do (Actions)
            • Loop - Actions
              • Unit - Add Max Life Modifier to Some_Unit
              • Unit - Set level of Max Life Modifier for Some_Unit to 4
              • Unit - Remove Max Life Modifier from Some_Unit
          • Set Max_Hp = (Max_Hp mod 100)
          • Set Loop_Integer = ((Max_Hp - (Max_Hp mod 10)) / 10)
          • For each (Integer A) from 1 to Loop_Integer, do (Actions)
            • Loop - Actions
              • Unit - Add Max Life Modifier to Some_Unit
              • Unit - Set level of Max Life Modifier for Some_Unit to 3
              • Unit - Remove Max Life Modifier from Some_Unit
          • Set Max_Hp = (Max_Hp mod 10)
          • For each (Integer A) from 1 to Max_Hp, do (Actions)
            • Loop - Actions
              • Unit - Add Max Life Modifier to Some_Unit
              • Unit - Set level of Max Life Modifier for Some_Unit to 2
              • Unit - Remove Max Life Modifier from Some_Unit
        • Else - Actions
          • Set Max_Hp = (0 - Max_Hp)
          • Set Loop_Integer = ((Max_Hp - (Max_Hp mod 100)) / 100)
          • For each (Integer A) from 1 to Loop_Integer, do (Actions)
            • Loop - Actions
              • Unit - Add Max Life Modifier to Some_Unit
              • Unit - Set level of Max Life Modifier for Some_Unit to 7
              • Unit - Remove Max Life Modifier from Some_Unit
          • Set Max_Hp = (Max_Hp mod 100)
          • Set Loop_Integer = ((Max_Hp - (Max_Hp mod 10)) / 10)
          • For each (Integer A) from 1 to Loop_Integer, do (Actions)
            • Loop - Actions
              • Unit - Add Max Life Modifier to Some_Unit
              • Unit - Set level of Max Life Modifier for Some_Unit to 6
              • Unit - Remove Max Life Modifier from Some_Unit
          • Set Max_Hp = (Max_Hp mod 10)
          • For each (Integer A) from 1 to Max_Hp, do (Actions)
            • Loop - Actions
              • Unit - Add Max Life Modifier to Some_Unit
              • Unit - Set level of Max Life Modifier for Some_Unit to 5
              • Unit - Remove Max Life Modifier from Some_Unit
      • Custom script: set udg_Some_Unit = null
and if its neither of those then it may be this trigger but i doubt it

  • Trigger Unit Adder
    • Events
      • Time - Every 0.25 seconds of game time
    • Conditions
    • Actions
      • Set Trigger_Adder_1 = (Units in (Playable map area))
      • Unit Group - Remove all units of Trigger_Adder_2 from Trigger_Adder_1
      • Unit Group - Pick every unit in Trigger_Adder_1 and do (Actions)
        • Loop - Actions
          • Unit Group - Add (Picked unit) to Trigger_Adder_2
          • Trigger - Add to Cyclone aura <gen> the event (Unit - (Picked unit) Takes damage)
      • Custom script: call DestroyGroup (udg_Trigger_Adder_1)
THX in advance for help.

heres the map.
 

Attachments

  • Ultimate Hero Wars.w3x
    525.2 KB · Views: 69
Last edited:

Dr Super Good

Spell Reviewer
Level 62
Joined
Jan 18, 2005
Messages
27,038
First cast lag will probably occur as it references abilities and units which might not be fully loaded yet.

If it still causes frames to be dropped, then it could be because you make 4 units at the same spot, try making them randomly in an area so the game has an easier time displacing them.

Reducing the procedural coupling might make it more efficient. An example could be making the same code to handle all levels instead of mirroing code.

Using JASS to create proper functions and more efficient code structures than those GUI makes would also cause the code to execute more efficiently so prevent the liklyhood of frame skipping.
 
Level 3
Joined
Mar 20, 2011
Messages
35
hmm im afraid its more sinister than that i have just done some testing and am now finding that all my spells seem to be increasing lag so i seem to have leak that is happening every time I cast a spell :vw_wtf:

I have tryed disabling all my pereodic triggers (didnt work)
 
Last edited:
Level 3
Joined
Mar 20, 2011
Messages
35
and 2-3 hours of fiddling around later the lag is caused by a triggered spell that I had accidently deleted the Dummy spell for so it was doing this

  • Tiger Roar
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Value
    • Actions
      • Set Tiger_Roar_Ugroup = (Units within 1000000000.00 of (Position of (Casting unit)) matching ((Race of (Matching unit)) Not equal to Night Elf))
      • Unit - Create 1 Dummy FTW for (Owner of (Casting unit)) at Dummy_Spawn_Pos facing Default building facing degrees
      • Unit - Add Dummy's Roar to (Last created unit)
      • Unit - Set level of Dummy's Roar for (Last created unit) to (Level of Max Mana Modifier for (Casting unit))
      • Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
      • Unit - Order (Last created unit) to Night Elf Druid Of The Claw - Roar
      • Unit Group - Pick every unit in Tiger_Roar_Ugroup and do (Actions)
        • Loop - Actions
          • Unit - Remove Roar buff from (Picked unit)
so every time i cast an abillity it would leak a location, create a unit, and order it to do a spell which would in turn repeat the trigger and hey presto theres my problem :ogre_haosis:
 
Top