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

Help with leaks please >;D

Status
Not open for further replies.
Level 9
Joined
Jun 10, 2013
Messages
473
Hey >:D can any one tell me if these leak and if so how to fix them please :)

  • Init Spell
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Spirits of the Forest (MB) (SA)
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • A_ActiveSpells Equal to 0
        • Then - Actions
          • Trigger - Turn on Rotation MUI <gen>
          • Trigger - Turn on ResetTriggers <gen>
        • Else - Actions
      • Set A_ActiveSpells = (A_ActiveSpells + 1)
      • Set A_MUIInteger = (A_MUIInteger + 1)
      • Set A_Hero[A_MUIInteger] = (Triggering unit)
      • Set A_Level[A_MUIInteger] = (Level of Spirits of the Forest (MB) (SA) for (Triggering unit))
      • Set A_TempPoint[1] = (Position of (Triggering unit))
      • Unit Group - Add (Triggering unit) to A_HeroesGroup
      • For each (Integer A_GeneralInteger[1]) from 1 to 5, do (Actions)
        • Loop - Actions
          • Set A_TempPoint[2] = (A_TempPoint[1] offset by 200.00 towards (72.00 x (Real(A_GeneralInteger[1]))) degrees)
          • Unit - Create 1 Birds (MB) for (Owner of (Triggering unit)) at A_TempPoint[2] facing ((72.00 x (Real(A_GeneralInteger[1]))) + 90.00) degrees
          • Unit Group - Add (Last created unit) to A_AllBirdsGroup
          • Set A_Birds[((A_MUIInteger x 5) - A_GeneralInteger[1])] = (Last created unit)
          • Special Effect - Create a special effect at A_TempPoint[2] using Objects\Spawnmodels\NightElf\EntBirthTarget\EntBirthTarget.mdl
          • Special Effect - Destroy (Last created special effect)
          • Unit - Set level of NegateExpirationTimer (MB) for (Last created unit) to (Level of Spirits of the Forest (MB) (SA) for (Triggering unit))
          • Custom script: call RemoveLocation (udg_A_TempPoint[2])
      • Custom script: call RemoveLocation (udg_A_TempPoint[1])
  • Rotation MUI
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in A_HeroesGroup and do (Actions)
        • Loop - Actions
          • For each (Integer A_GeneralInteger[1]) from 1 to A_MUIInteger, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • A_Hero[A_GeneralInteger[1]] Equal to (Picked unit)
                • Then - Actions
                  • Set A_GeneralInteger[3] = 0
                  • Set A_TempPoint[1] = (Position of A_Hero[A_GeneralInteger[1]])
                  • For each (Integer A_GeneralInteger[2]) from 1 to 5, do (Actions)
                    • Loop - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (A_Birds[((A_GeneralInteger[1] x 5) - A_GeneralInteger[2])] is in A_AllBirdsGroup) Equal to True
                        • Then - Actions
                          • Set A_TempPoint[2] = (A_TempPoint[1] offset by 200.00 towards ((72.00 x (Real(A_GeneralInteger[2]))) - A_RadReal) degrees)
                          • Unit - Move A_Birds[((A_GeneralInteger[1] x 5) - A_GeneralInteger[2])] instantly to A_TempPoint[2], facing ((Angle from A_TempPoint[1] to A_TempPoint[2]) - 90.00) degrees
                          • Set A_TargetGroups[1] = (Units within 400.00 of A_TempPoint[2] matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is Magic Immune) Equal to False) and ((((Matching unit) is alive) Equal to True) and ((((Matching unit) belongs to an enemy of (Owner of
                          • Set A_FinalTarget = (Random unit from A_TargetGroups[1])
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • A_FinalTarget Not equal to No unit
                              • (A_Hero[A_GeneralInteger[1]] has buff Spirits of the Forest (MB)) Equal to True
                            • Then - Actions
                              • Unit Group - Add A_FinalTarget to A_AttackedUnits
                              • Unit Group - Remove A_Birds[((A_GeneralInteger[1] x 5) - A_GeneralInteger[2])] from A_AllBirdsGroup
                              • Unit Group - Add A_Birds[((A_GeneralInteger[1] x 5) - A_GeneralInteger[2])] to A_TravelingBirds
                              • Unit - Order A_Birds[((A_GeneralInteger[1] x 5) - A_GeneralInteger[2])] to Neutral - Kaboom! A_FinalTarget
                              • Unit - Set level of NegateExpirationTimer (MB) for A_Birds[((A_GeneralInteger[1] x 5) - A_GeneralInteger[2])] to 4
                              • Unit - Set level of BirdsAttack (MB) for A_Birds[((A_GeneralInteger[1] x 5) - A_GeneralInteger[2])] to (Level of Spirits of the Forest (MB) (SA) for A_Hero[A_GeneralInteger[1]])
                            • Else - Actions
                          • Custom script: call DestroyGroup (udg_A_TargetGroups[1])
                          • Custom script: call RemoveLocation (udg_A_TempPoint[2])
                        • Else - Actions
                          • Set A_GeneralInteger[3] = (A_GeneralInteger[3] + 1)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • A_GeneralInteger[3] Greater than or equal to 5
                    • Then - Actions
                      • Unit - Remove Spirits of the Forest (MB) buff from A_Hero[A_GeneralInteger[1]]
                      • Set A_Hero[A_GeneralInteger[1]] = No unit
                      • Unit Group - Remove A_Hero[A_GeneralInteger[1]] from A_HeroesGroup
                    • Else - Actions
                  • Custom script: call RemoveLocation (udg_A_TempPoint[1])
                • Else - Actions
      • Unit Group - Pick every unit in A_TravelingBirds and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Current order of (Picked unit)) Not equal to (Order(selfdestruct))
            • Then - Actions
              • Set A_TempPoint[1] = (Position of (Picked unit))
              • Unit - Order (Picked unit) to Neutral - Kaboom! A_TempPoint[1]
              • Special Effect - Create a special effect at A_TempPoint[1] using Objects\Spawnmodels\NightElf\NEDeathSmall\NEDeathSmall.mdl
              • Special Effect - Destroy (Last created special effect)
              • Custom script: call RemoveLocation (udg_A_TempPoint[1])
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • A_RadReal Greater than or equal to 358.00
        • Then - Actions
          • Set A_RadReal = 0.00
        • Else - Actions
          • Set A_RadReal = (A_RadReal + 2.00)
  • Birds Spell Effects
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to BirdsAttack (MB)
    • Actions
      • Unit Group - Remove (Target unit of ability being cast) from A_AttackedUnits
      • Set A_TempPoint[1] = (Position of (Triggering unit))
      • Set A_TargetGroups[1] = (Units within 200.00 of A_TempPoint[1] matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is Magic Immune) Equal to False) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of (
      • Unit Group - Pick every unit in A_TargetGroups[1] and do (Actions)
        • Loop - Actions
          • Set A_TempPoint[2] = (Position of (Picked unit))
          • Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Weapons\GreenDragonMissile\GreenDragonMissile.mdl
          • Special Effect - Destroy (Last created special effect)
          • Unit - Cause (Triggering unit) to damage (Picked unit), dealing (15.00 x (Real((Level of BirdsAttack (MB) for (Triggering unit))))) damage of attack type Spells and damage type Normal
          • Set A_GeneralInteger[1] = (Random integer number between 1 and 3)
          • Unit - Create 1 SpellDummy (MB) for (Owner of (Triggering unit)) at A_TempPoint[2] facing Default building facing degrees
          • Unit - Add a (Random real number between 0.80 and 1.20) second Generic expiration timer to (Last created unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • A_GeneralInteger[1] Equal to 1
            • Then - Actions
              • Unit - Set level of Enchantment (MB) for (Last created unit) to (Level of BirdsAttack (MB) for (Triggering unit))
              • Unit - Order (Last created unit) to Undead Banshee - Curse (Picked unit)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • A_GeneralInteger[1] Equal to 2
                • Then - Actions
                  • Unit - Set level of Root (MB) for (Last created unit) to (Level of BirdsAttack (MB) for (Triggering unit))
                  • Unit - Order (Last created unit) to Undead Necromancer - Cripple (Picked unit)
                • Else - Actions
                  • Unit - Set level of Poison (MB) for (Last created unit) to (Level of BirdsAttack (MB) for (Triggering unit))
                  • Unit - Order (Last created unit) to Neutral Alchemist - Acid Bomb (Picked unit)
          • Custom script: call RemoveLocation (udg_A_TempPoint[2])
      • Custom script: call DestroyGroup (udg_A_TargetGroups[1])
      • Custom script: call RemoveLocation (udg_A_TempPoint[1])
  • ResetTriggers
    • Events
      • Unit - A unit Dies
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • ((Triggering unit) is in (Units of type Birds (MB))) Equal to True
          • ((Triggering unit) is in (Units of type SpellDummy (MB))) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • ((Triggering unit) is in (Units of type Birds (MB))) Equal to True
              • (Number of units in (Units of type Birds (MB))) Equal to 0
        • Then - Actions
          • Set A_MUIInteger = 0
          • Set A_ActiveSpells = 0
          • Trigger - Turn off (This trigger)
          • Trigger - Turn off Rotation MUI <gen>
        • Else - Actions
      • Unit - Remove (Triggering unit) from the game
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • ((Triggering unit) is in (Units of type Birds (MB))) Equal to True
              • ((Triggering unit) is in A_AllBirdsGroup) Equal to True
        • Then - Actions
          • Set A_TempPoint[1] = (Position of (Triggering unit))
          • Special Effect - Create a special effect at A_TempPoint[1] using Objects\Spawnmodels\NightElf\EntBirthTarget\EntBirthTarget.mdl
          • Special Effect - Destroy (Last created special effect)
          • Custom script: call RemoveLocation (udg_A_TempPoint[1])
        • Else - Actions
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
0.02 could be 0.03. Optimizes 50%!
But next to that, I cant really see a leak.
General leaks are Player Groups (DestroyForce()), Unit Groups (DestroyGroup()), Locations/Points (RemoveLocation()), Special Effects (Destroy <special effect> (GUI)) and handles (any in-game object) saved in a global array variable that never gets removed (ussually saved in an array under the index of a unit and not removed when unit dies).

But you did a great job keeping it clean from leaks.

One more thing though...
When posting enormous large stuff (that would increase the web page width), you should place them inside HIDDEN tags so you can hide them to not make the page be so wide like this one :D
[ HIDDEN=...][/HIDDEN] (without the space at the start)
 
Level 9
Joined
Jun 10, 2013
Messages
473
0.02 could be 0.03. Optimizes 50%!
But next to that, I cant really see a leak.
General leaks are Player Groups (DestroyForce()), Unit Groups (DestroyGroup()), Locations/Points (RemoveLocation()), Special Effects (Destroy <special effect> (GUI)) and handles (any in-game object) saved in a global array variable that never gets removed (ussually saved in an array under the index of a unit and not removed when unit dies).

But you did a great job keeping it clean from leaks.

One more thing though...
When posting enormous large stuff (that would increase the web page width), you should place them inside HIDDEN tags so you can hide them to not make the page be so wide like this one :D
[ HIDDEN=...][/HIDDEN] (without the space at the start)

Yeah sorry didn't know if you could do a trigger box and a hidden box :S
and their Palladons not mine was just curious because of a bug I encounter with it
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
Units of type x always leaks. You should try to avoid it.
I cant really find where he uses that but that doesnt make it less true.

Alternative:
  • Actions
    • Set TempGroup[0] = (Units in (Entire map))
    • Unit Group - Pick every unit in TempGroup[0] and do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Unit-type of (Picked unit)) Equal to Footman
          • Then - Actions
            • -------- do stuff --------
          • Else - Actions
            • Unit Group - Remove (Picked unit) from TempGroup[0]
Or use the matching unit-type thing but try to avoid multiple iterations.
Using the matching thing does exactly the same as this but when you use both the loop and a matching condition, then you are doing duplicate work for example.
 
Status
Not open for further replies.
Top