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

[Trigger] Leak fix help

Status
Not open for further replies.
Level 8
Joined
Oct 9, 2011
Messages
101
My spell causes the game to lag after a few casts and I can't find the leak. Just started modding again after a few years and maybe I forgot something. Please help me know what's the cause of the lag.
  • Attack Loop
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Attack_UnitGroup and do (Actions)
        • Loop - Actions
          • Set TempUnit = (Picked unit)
          • Set ID = (Custom value of TempUnit)
          • Set TempPlayer = (Owner of TempUnit)
          • Set Attack_Duration[ID] = (Attack_Duration[ID] - 0.10)
            • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • Attack_Duration[ID] Equal to (==) 0.50
              • Then - Actions
                • Unit - Pause Attack_Caster[ID]
              • Else - Actions
            • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • Attack_Duration[ID] Less than or equal to (<=) 0.00
              • Then - Actions
                • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • Attack_Combo[ID] Equal to (==) 1
                  • Then - Actions
                    • Set TempReal = 0.00
                      • Do Multiple ActionsFor each (Integer Attack_RangeIncrement[ID]) from 1 to 5, do (Actions)
                        • Loop - Actions
                          • Set TempReal = (TempReal + Attack_Range[ID])
                          • Set Attack_DamagePoint[ID] = (Attack_Point[ID] offset by TempReal towards Attack_Angle[ID] degrees)
                          • Custom script: set bj_wantDestroyGroup = true
                          • Unit Group - Pick every unit in (Units within Attack_Radius[ID] of Attack_DamagePoint[ID]) and do (Actions)
                            • Loop - Actions
                              • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • Multiple ConditionsAnd - All (Conditions) are true
                                    • Conditions
                                      • ((Picked unit) belongs to an enemy of TempPlayer) Equal to (==) True
                                      • ((Picked unit) is alive) Equal to (==) True
                                • Then - Actions
                                  • Unit Group - Add (Picked unit) to Attack_DamageGroup[ID]
                                  • Sound - Play MetalMediumSliceFlesh3 <gen> at 100.00% volume, attached to (Picked unit)
                                • Else - Actions
                          • Unit Group - Pick every unit in Attack_DamageGroup[ID] and do (Actions)
                            • Loop - Actions
                              • Unit - Cause TempUnit to damage (Picked unit), dealing Attack_Damage[ID] damage of attack type Hero and damage type Normal
                    • Unit Group - Remove all units from Attack_DamageGroup[ID]
                    • Custom script: call DestroyGroup(udg_Attack_DamageGroup[udg_ID])
                  • Else - Actions
                    • Custom script: set bj_wantDestroyGroup = true
                    • Unit Group - Pick every unit in (Units within Attack_Radius[ID] of Attack_DamagePoint[ID]) and do (Actions)
                      • Loop - Actions
                        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                          • If - Conditions
                            • Multiple ConditionsAnd - All (Conditions) are true
                              • Conditions
                                • ((Picked unit) belongs to an enemy of TempPlayer) Equal to (==) True
                                • ((Picked unit) is alive) Equal to (==) True
                          • Then - Actions
                            • Sound - Play MetalMediumSliceFlesh3 <gen> at 100.00% volume, attached to (Picked unit)
                            • Unit - Cause TempUnit to damage (Picked unit), dealing Attack_Damage[ID] damage of attack type Hero and damage type Normal
                          • Else - Actions
                • Set Attack_IsAttacking[ID] = False
                • Unit - Unpause Attack_Caster[ID]
                • Custom script: call RemoveLocation(udg_Attack_DamagePoint[udg_ID])
                • Unit Group - Remove TempUnit from Attack_UnitGroup
                  • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Attack_UnitGroup is empty) Equal to (==) True
                    • Then - Actions
                      • Trigger - Turn off Attack Loop <gen>
                    • Else - Actions
              • Else - Actions
 
Last edited:
Level 8
Joined
Oct 9, 2011
Messages
101
So that's it. I was wondering if that's it. Thanks again!

Attack_DamageGroup[ID] is destroyed but never created? Hence you may be trying to add units to a null group.
Ohh. So I have to set a variable of the unit group before adding units to it? The code still works for the group part though, what happens when you add units to a null group?
 
Last edited by a moderator:
Status
Not open for further replies.
Top