Trigger Leak help

Monictor

New Member
Reaction score
0
Need guidance on removing leaks from my triggers. I have read the post that talks about removing links, but I am having some general issues. I haven't taken the time to learn JASS yet. I have tons of triggers in my game that are like the one below, 14 that are just like it. But I don't know how to remove the point leaks from it most conservatively (keeping the trigger as small as possible). My specific problem is that I have lots of variables refering to regions, points, and units with an array and something like (playernumber of (Owner of (Triggering Unit))), and I don't know what to put in the custom scripts. Anyways, help with this trigger will likely give me some clues as to how to remove many of the others.

Trigger:
  • Druid
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Druid (Night Elf Form)
    • Actions
      • Set ADruid[(Player number of (Owner of (Triggering unit)))] = (Triggering unit)
      • Hero - Create Mana Shards and give it to (Triggering unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in (Units in UnitSlot1[(Player number of (Owner of (Triggering unit)))])) Equal to 0
        • Then - Actions
          • Unit - Move (Triggering unit) instantly to (Center of UnitSlot1[(Player number of (Owner of (Triggering unit)))])
          • Unit - Create 1 Druid Sanctuary for (Owner of (Triggering unit)) at (Center of BuildSlot1[(Player number of (Owner of (Triggering unit)))]) facing Default building facing degrees
          • Skip remaining actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in (Units in UnitSlot2[(Player number of (Owner of (Triggering unit)))])) Equal to 0
        • Then - Actions
          • Unit - Move (Triggering unit) instantly to (Center of UnitSlot2[(Player number of (Owner of (Triggering unit)))])
          • Unit - Create 1 Druid Sanctuary for (Owner of (Triggering unit)) at (Center of BuildSlot2[(Player number of (Owner of (Triggering unit)))]) facing Default building facing degrees
          • Skip remaining actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in (Units in UnitSlot3[(Player number of (Owner of (Triggering unit)))])) Equal to 0
        • Then - Actions
          • Unit - Move (Triggering unit) instantly to (Center of UnitSlot3[(Player number of (Owner of (Triggering unit)))])
          • Unit - Create 1 Druid Sanctuary for (Owner of (Triggering unit)) at (Center of BuildSlot3[(Player number of (Owner of (Triggering unit)))]) facing Default building facing degrees
          • Skip remaining actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in (Units in UnitSlot4[(Player number of (Owner of (Triggering unit)))])) Equal to 0
        • Then - Actions
          • Unit - Move (Triggering unit) instantly to (Center of UnitSlot4[(Player number of (Owner of (Triggering unit)))])
          • Unit - Create 1 Druid Sanctuary for (Owner of (Triggering unit)) at (Center of BuildSlot4[(Player number of (Owner of (Triggering unit)))]) facing Default building facing degrees
          • Skip remaining actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in (Units in UnitSlot5[(Player number of (Owner of (Triggering unit)))])) Equal to 0
        • Then - Actions
          • Unit - Move (Triggering unit) instantly to (Center of UnitSlot5[(Player number of (Owner of (Triggering unit)))])
          • Unit - Create 1 Druid Sanctuary for (Owner of (Triggering unit)) at (Center of BuildSlot5[(Player number of (Owner of (Triggering unit)))]) facing Default building facing degrees
          • Skip remaining actions
        • Else - Actions


If you would like to tell me how to give +rep, I can do it.

Thanks for any help.
 

Monictor

New Member
Reaction score
0
Sorry if it is improper to do this, but I thought it might be better to include it here rather than elsewhere. Here is another one that will probably create the most leaks in my game because it is used a lot. The custom script in it was given to me by a member of this forum, and I use it for a height check on the position of the unit and the target spot I want it to move to. I am going to have to change it eventually though ot accomodate for more players who could be using the trigger at the same time like with most of my other triggers.

Trigger:
  • Movement Trig
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • (Ability being cast) Equal to Movement
          • Or - Any (Conditions) are true
            • Conditions
              • ((Triggering unit) has an item of type Move Item (3)) Equal to True
              • ((Triggering unit) has an item of type Move Item (4)) Equal to True
              • ((Triggering unit) has an item of type Move Item (5)) Equal to True
              • ((Triggering unit) has an item of type Move Item (6)) Equal to True
    • Actions
      • Region - Center MoveFrom[(Player number of (Owner of (Triggering unit)))] on (Position of (Casting unit))
      • Region - Center MoveTo[(Player number of (Owner of (Triggering unit)))] on (Position of (Target unit of ability being cast))
      • Wait 0.10 seconds
      • Set tempPoint = (Position of (Triggering unit))
      • Custom script: set udg_Zpoint[1] = GetLocationZ(udg_tempPoint)
      • Set tempPoint = (Position of (Target unit of ability being cast))
      • Custom script: set udg_Zpoint[2] = GetLocationZ(udg_tempPoint)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Abs((Zpoint[1] - Zpoint[2]))) Less than or equal to 110.00
        • Then - Actions
          • Unit - Remove (Target unit of ability being cast) from the game
          • Item - Set life of (Item carried by (Casting unit) of type Move Item (3)) to ((Current life of (Item carried by (Casting unit) of type Move Item (3))) - 1.00)
          • Item - Set life of (Item carried by (Casting unit) of type Move Item (4)) to ((Current life of (Item carried by (Casting unit) of type Move Item (4))) - 1.00)
          • Item - Set life of (Item carried by (Casting unit) of type Move Item (5)) to ((Current life of (Item carried by (Casting unit) of type Move Item (5))) - 1.00)
          • Item - Set life of (Item carried by (Casting unit) of type Move Item (6)) to ((Current life of (Item carried by (Casting unit) of type Move Item (6))) - 1.00)
          • Item - Set life of (Item carried by (Triggering unit) of type Blade of Thirsting +2) to ((Current life of (Item carried by (Triggering unit) of type Blade of Thirsting +2)) - 1.00)
          • Item - Set charges remaining in (Item carried by (Casting unit) of type Move Item (3)) to ((Charges remaining in (Item carried by (Casting unit) of type Move Item (3))) - 1)
          • Item - Set charges remaining in (Item carried by (Casting unit) of type Move Item (4)) to ((Charges remaining in (Item carried by (Casting unit) of type Move Item (4))) - 1)
          • Item - Set charges remaining in (Item carried by (Casting unit) of type Move Item (5)) to ((Charges remaining in (Item carried by (Casting unit) of type Move Item (5))) - 1)
          • Item - Set charges remaining in (Item carried by (Casting unit) of type Move Item (6)) to ((Charges remaining in (Item carried by (Casting unit) of type Move Item (6))) - 1)
          • Item - Set charges remaining in (Item carried by (Triggering unit) of type Blade of Thirsting +2) to ((Charges remaining in (Item carried by (Triggering unit) of type Blade of Thirsting +2)) - 1)
          • Unit - Make (Casting unit) face (Target unit of ability being cast) over 0.00 seconds
          • Wait 0.05 seconds
          • Unit - Move (Triggering unit) instantly to (Center of MoveTo[(Player number of (Owner of (Triggering unit)))])
          • If ((Battleground ONE <gen> contains (Triggering unit)) Equal to True) then do (Unit - Create 1 Positioner Purple for Player 12 (Brown) at (Center of MoveFrom[(Player number of (Owner of (Triggering unit)))]) facing Default building facing degrees) else do (Do nothing)
          • If ((Battleground TWO <gen> contains (Triggering unit)) Equal to True) then do (Unit - Create 1 Positioner Green for Player 12 (Brown) at (Center of MoveFrom[(Player number of (Owner of (Triggering unit)))]) facing Default building facing degrees) else do (Do nothing)
          • If ((Battleground THREE <gen> contains (Triggering unit)) Equal to True) then do (Unit - Create 1 Positioner Green for Player 12 (Brown) at (Center of MoveFrom[(Player number of (Owner of (Triggering unit)))]) facing Default building facing degrees) else do (Do nothing)
        • Else - Actions
          • Game - Display to (All players matching ((Owner of (Triggering unit)) Equal to (Matching player))) the text: The height differen...


I realize that instead of moving the zones I could just move the unit from one tempPoint to another, but I haven't changed it yet. I made this trigger a long time ago as it is a large part of my game.
 

Exide

I am amazingly focused right now!
Reaction score
448
In your first trigger:

Code:
Druid 
Events 
Unit - A unit enters (Playable map area) 
Conditions 
(Unit-type of (Triggering unit)) Equal to Druid (Night Elf Form) 
Actions 
Set ADruid[(Player number of (Owner of (Triggering unit)))] = (Triggering unit) 
Hero - Create Mana Shards and give it to (Triggering unit) 
If (All Conditions are True) then do (Then Actions) else do (Else Actions) 
If - Conditions 
[COLOR="Red"](Number of units in (Units in UnitSlot1[(Player number of (Owner of (Triggering unit)))])) Equal to 0[/COLOR]
Then - Actions
Unit - Move (Triggering unit) instantly to [COLOR="red"](Center of UnitSlot1[(Player number of (Owner of (Triggering unit)))])[/COLOR]
Unit - Create 1 Druid Sanctuary for (Owner of (Triggering unit)) [COLOR="red"]at (Center of BuildSlot1[(Player number of (Owner of (Triggering unit)))])[/COLOR] facing Default building facing degrees 
Skip remaining actions 
Else - Actions

The red colored text leaks. (It does on all conditions, of course, but I take the first as an example.)

To fix them, do this:

Trigger:
  • set tempgroup = All units in UnitSlot1[Player Number of (Owner of (Triggering Unit))]
    • If (All conditions are true)
    • Number of Units in tempgroup Equal to 0
    • Then actions..
    • set temppoint = Center of UnitSlot1[Player Number of (Owner of (Triggering Unit))]
    • Unit - Move (Triggering unit) instantly to temppoint
    • custom script call RemoveLocation(udg_temppoint)
    • set temppoint = Center of BuildSlot1[Player Number of (Owner of (Triggering Unit))]
    • Unit - Create 1 Druid Sanctuary for (Owner of (Triggering unit)) at temppoint facing Default building facing degrees
    • custom script call RemoveLocation(udg_temppoint)


-Do this for all conditions in that trigger.

In your second trigger you've got a point leak (Move unit instantly to ...), Displaying text messages to player groups (except (All Players)), and creating regions leaks, too.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top