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

[Trigger] Removing all Leaks

Status
Not open for further replies.
Level 1
Joined
Sep 8, 2017
Messages
4
So after looking more into leaks I decided to start coding in something to clean my triggers. I do not know JASS so I am trying to figure it out as I go. Here is my trigger so far and all I am trying to do is clean locations.
  • Holy Used
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Holy Land
    • Actions
      • Set Point[((Player number of (Owner of (Triggering unit))) - 1)] = (Target point of ability being cast)
      • Set CreatedUnit2[((Player number of (Owner of (Triggering unit))) + 100)] = (Casting unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Holy Land for CreatedUnit2[((Player number of (Owner of (Triggering unit))) + 100)]) Equal to 1
        • Then - Actions
          • Set Area[(2 + (Player number of (Owner of (Triggering unit))))] = 350.00
          • Set Damage[((Player number of (Owner of (Triggering unit))) - 1)] = 10
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Holy Land for CreatedUnit2[((Player number of (Owner of (Triggering unit))) + 100)]) Equal to 2
            • Then - Actions
              • Set Area[(2 + (Player number of (Owner of (Triggering unit))))] = 450.00
              • Set Damage[((Player number of (Owner of (Triggering unit))) - 1)] = 15
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of Holy Land for CreatedUnit2[((Player number of (Owner of (Triggering unit))) + 100)]) Equal to 3
                • Then - Actions
                  • Set Area[(2 + (Player number of (Owner of (Triggering unit))))] = 550.00
                  • Set Damage[((Player number of (Owner of (Triggering unit))) - 1)] = 20
                • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Casting unit) has buff Divine Shield) Equal to True
        • Then - Actions
          • For each (Integer A) from 1 to 4, do (Actions)
            • Loop - Actions
              • Unit - Create 1 Footman for (Owner of (Triggering unit)) at (Point[((Player number of (Owner of (Triggering unit))) - 1)] offset by 100.00 towards (45.00 + (90.00 x ((Real((Integer A))) - 1.00))) degrees) facing Default building facing degrees
              • Special Effect - Create a special effect attached to the overhead of (Last created unit) using Abilities\Spells\Human\Resurrect\ResurrectCaster.mdl
        • Else - Actions
          • Do nothing
      • Environment - Change terrain type at Point[((Player number of (Owner of (Triggering unit))) - 1)] to Ashenvale - Grass Cliff using variation -1 in an area of size ((Integer(Area[2])) / 100) and shape Circle
      • Unit - Create 1 Dummy 2 for (Owner of (Triggering unit)) at (Center of Holy Land Thing <gen>) facing Default building facing degrees
      • Wait 0.01 seconds
      • Unit - Remove (Last created unit) from the game
      • Environment - Create at (Region centered at Point[((Player number of (Owner of (Triggering unit))) - 1)] with size (Area[(2 + (Player number of (Owner of (Triggering unit))))], Area[(2 + (Player number of (Owner of (Triggering unit))))])) the weather effect Rays Of Light
      • Environment - Turn (Last created weather effect) On
      • Unit - Remove Devotion Aura from (Triggering unit)
      • Unit - Set the custom value of Unit to 4
      • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at Point[((Player number of (Owner of (Triggering unit))) - 1)] facing Default building facing degrees
      • Set CreatedUnit[62] = (Last created unit)
      • Unit - Set level of Holy Land Buff for CreatedUnit[62] to (Level of Holy Land for CreatedUnit[((Player number of (Owner of (Triggering unit))) + 100)])
      • Wait 20.00 seconds
      • Unit - Remove CreatedUnit[62] from the game
      • Trigger - Turn off Holy Land Regen <gen>
      • Environment - Remove (Last created weather effect)
      • Environment - Change terrain type at Point[((Player number of (Owner of (Triggering unit))) - 1)] to Cityscape - Grass Trim using variation -1 in an area of size ((Integer(Area[2])) / 100) and shape Circle
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit has buff Divine Shield) Equal to True
        • Then - Actions
          • Unit - Add Devotion Aura to CreatedUnit2[((Player number of (Owner of (Triggering unit))) + 100)]
          • Unit - Set level of Devotion Aura for CreatedUnit2[((Player number of (Owner of (Triggering unit))) + 100)] to 4
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Holy Land for CreatedUnit2[((Player number of (Owner of (Triggering unit))) + 100)]) Equal to 1
            • Then - Actions
              • Unit - Add Devotion Aura to CreatedUnit2[((Player number of (Owner of (Triggering unit))) + 100)]
              • Unit - Set level of Devotion Aura for CreatedUnit2[((Player number of (Owner of (Triggering unit))) + 100)] to 1
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of Holy Land for CreatedUnit2[((Player number of (Owner of (Triggering unit))) + 100)]) Equal to 2
                • Then - Actions
                  • Unit - Add Devotion Aura to CreatedUnit2[((Player number of (Owner of (Triggering unit))) + 100)]
                  • Unit - Set level of Devotion Aura for CreatedUnit2[((Player number of (Owner of (Triggering unit))) + 100)] to 2
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Level of Holy Land for CreatedUnit2[((Player number of (Owner of (Triggering unit))) + 100)]) Equal to 3
                    • Then - Actions
                      • Unit - Add Devotion Aura to CreatedUnit2[((Player number of (Owner of (Triggering unit))) + 100)]
                      • Unit - Set level of Devotion Aura for CreatedUnit2[((Player number of (Owner of (Triggering unit))) + 100)] to 3
                    • Else - Actions
      • Custom script: call RemoveLocation(udg_Point[( GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))-1)]
So ignore the wonky player number + 100, before I had no system of what index I had used before so I was just picking a number I know I had not used. This works for now since I don't want to redo all the trigger. The system I have now is working fine though. But in the custom script this is probably just me not knowing the language well enough, I get an error message telling me it expects a '. Thanks for the help in Advance.
Oh and side note, the reason I am using this system of player number nonsense is so when different players cast the same spell at different points I don't want the variables getting mixed up if the code has a wait in it. Anyone looking probably already knows that but I just wanted to ask if anyone knew of a better system so that maybe I wouldn't have to use these wild indexes. Thanks again!
[Edit]-found the problem was just a ) at the end haha oh well but now I want to know if anyone has any better ideas for labeling these abilities points. Also I am having a problem with the terrain change in this, it does not seem to be running at all. I get the dummy that spawns at the point but that is it. No terrain.

[Edit] I may be getting into my own head about this stuff but my map spawns a lot of units continuously so for a trigger like this
  • Unit - Create 1 Footman for (Owner of (Triggering unit)) at (Point[((Player number of (Owner of (Triggering unit))) - 1)] offset by 100.00 towards (45.00 + (90.00 x ((Real((Integer A))) - 1.00))) degrees) facing Default building facing degrees
At the end of the whole trigger I remove the location of Point[some array]. But does that tie up the units created from the point too? Do those points with off set leak as well? The units too they are supposed to be destroyed at the end of the trigger, removing them from the game is not good enough right? I have to destroy them?
 
Last edited:
Level 14
Joined
Aug 31, 2009
Messages
775
If you create a unit at a "Point offset by..." It will leak.

You need to do something more like:
Set point = (something) then do something like Set Point2 = Point1 offset by ....

Create your unit at point 2, then clear the leaks for point 1 and 2 individually.

Units always leak, and unfortunately there's nothing you can do it about it. Either destroying them (unit - kill unit) or removing them from the game is the best thing you can do, but it's never perfect.
 
Status
Not open for further replies.
Top