• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[General] Fixing the leaks in my Map

Status
Not open for further replies.
Level 15
Joined
Jan 12, 2011
Messages
1,197
When I play my map it starts lagging after a few minutes later. I do not know why. Maybe because of the doodads or the imported models, or the spells are maybe leaky. Unfortunately, I do not know how to fix it.
I attach my map below. I would be grateful if you could help me how to fix leaks with triggers. If you want, you can do it in my map then send it to me when it is fixed. Thanks.
 

Attachments

  • Through Snow and Ice v.2.1.w3x
    7.7 MB · Views: 35
Level 13
Joined
Mar 24, 2013
Messages
1,105
  • Mighty Hammer casting
    • Events
      • Time - Every 0.01 seconds of game time
    • Conditions
    • Actions
      • Set MightyHammer_Countdown = (MightyHammer_Countdown - 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • MightyHammer_Countdown Less than or equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
          • Unit Group - Remove all units from MightyHammer_DamageGroup
          • Unit - Kill MightyHammer_Hammer
          • Custom script: call DestroyGroup(udg_MightyHammer_DamageGroup)
        • Else - Actions
          • Set MightyHammer_Point = (Position of MightyHammer_Hammer)
          • Set MightyHammer_Point2 = (MightyHammer_Point offset by 6.00 towards MightyHammer_Angle degrees)
          • Unit - Move MightyHammer_Hammer instantly to MightyHammer_Point2
          • Set MightyHammer_UnitGroup = (Units within 250.00 of MightyHammer_Point2 matching ((((Owner of (Matching unit)) is an enemy of (Owner of MightyHammer_Hero)) Equal to True) and ((((Matching unit) is in MightyHammer_DamageGroup) Equal to False) and (((Matching unit) is alive) Equal to True
          • Unit Group - Pick every unit in MightyHammer_UnitGroup and do (Actions)
            • Loop - Actions
              • Special Effect - Create a special effect attached to the overhead of (Picked unit) using Abilities\Spells\Human\StormBolt\StormBoltMissile.mdl
              • Special Effect - Destroy (Last created special effect)
              • Unit Group - Add (Picked unit) to MightyHammer_DamageGroup
              • Unit - Cause MightyHammer_Hero to damage (Picked unit), dealing ((100.00 x (Real((Level of Mighty Hammer (Orc Warchief) for MightyHammer_Hero)))) x (Real(Weaponcraft[(Player number of (Owner of MightyHammer_Hero))]))) damage of attack type Spells and damage type Normal
          • Custom script: call RemoveLocation(udg_MightyHammer_Point)
          • Custom script: call RemoveLocation(udg_MightyHammer_Point2)
          • Custom script: call DestroyGroup(udg_MightyHammer_UnitGroup)


  • [TRIGGER]Tri Arrow
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Tri-Arrow
    • Actions
      • Unit Group - Pick every unit in (Units within 1000.00 of (Position of (Triggering unit))) and do (Actions)
        • Loop - Actions
          • Unit Group - Add (Picked unit) to TriUnitsArrow
          • Set TriArrowLimit = (Number of units in TriUnitsArrow)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • TriArrowLimit Less than or equal to 3
            • Then - Actions
              • Unit Group - Pick every unit in TriUnitsArrow and do (Actions)
                • Loop - Actions
                  • Unit - Create 1 Dummy (Tri-Arrow) for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing Default building facing degrees
                  • Unit - Order (Last created unit) to Night Elf Warden - Shadow Strike (Picked unit)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) has buff Shadow Strike) Equal to True
                    • Then - Actions
                      • Unit - Kill (Last created unit)
                      • Unit Group - Remove all units of TriUnitsArrow from TriUnitsArrow
                    • Else - Actions
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • TriArrowLimit Greater than 3
                • Then - Actions
                  • Unit Group - Remove (Random unit from (Random (TriArrowLimit - 4) units from TriUnitsArrow)) from TriUnitsArrow **Unit Group Leak here too
                  • Unit Group - Pick every unit in TriUnitsArrow and do (Actions)
                    • Loop - Actions
                      • Unit - Create 1 Dummy (Tri-Arrow) for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing Default building facing degrees
                      • Unit - Order (Last created unit) to Night Elf Warden - Shadow Strike (Picked unit)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • ((Picked unit) has buff Shadow Strike) Equal to True
                        • Then - Actions
                          • Unit - Kill (Last created unit)
                          • Unit Group - Remove all units of TriUnitsArrow from TriUnitsArrow
                        • Else - Actions
                • Else - Actions


  • CH 1 per type
    • Events
      • Time - Elapsed game time is 1.00 seconds
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • Player - Limit training of Acentis to 1 for (Random player from (Player group(Player 1 (Red))))
          • Player - Limit training of Zul'usx Magician to 1 for (Random player from (Player group(Player 1 (Red))))
          • Player - Limit training of Dwarven Rider to 1 for (Random player from (Player group(Player 1 (Red))))
          • Player - Limit training of Kul'Tiras Mage to 1 for (Random player from (Player group(Player 1 (Red))))
          • Player - Limit training of Frozen Spirit to 1 for (Random player from (Player group(Player 1 (Red))))
          • Player - Limit training of Wild Wizard to 1 for (Random player from (Player group(Player 1 (Red))))
          • Player - Limit training of Ogrim Doomhammer to 1 for (Random player from (Player group(Player 1 (Red))))
          • Player - Limit training of Obsidian Overlord to 1 for (Random player from (Player group(Player 1 (Red))))
          • Player - Limit training of Janer Skymercina to 1 for (Random player from (Player group(Player 1 (Red))))
          • Player - Limit training of Archer Mistress to 1 for (Random player from (Player group(Player 1 (Red))))
          • Player - Limit training of Sorceress to 1 for (Random player from (Player group(Player 1 (Red))))


  • Elemental Aura 2
    • Events
      • Time - Every 0.03 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 Elemental Aura ) Equal to True
            • Then - Actions
              • Unit - Add Spellbook (Elemental Aura 2) to (Picked unit)
            • Else - Actions
              • Unit - Remove Spellbook (Elemental Aura 2) from (Picked unit)


Your map has a lot of function calls and could use some TLC to make it nice and polished.
 
Level 26
Joined
Sep 26, 2009
Messages
2,418
And I do think it's just fine to have many unit groups as long that you destroy it if it will not be used anymore.
The problem may not be in leaks when using group, but that he picks every unit in map and sorts trough them every 0,03 seconds.
If he has too many units in map, it may lag the game, not to mention if he has more triggers like that running at the same time.
 
Status
Not open for further replies.
Top