[Solved] leaks in distance check condition?

Status
Not open for further replies.
Level 4
Joined
Aug 17, 2008
Messages
80
  • Investigate
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Investigate Rocks
    • Actions
      • Set Investigate_Group = (Units in (Playable map area))
      • Set loc = (Position of (Triggering unit))
      • Unit Group - Pick every unit in Investigate_Group and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Distance between loc and (Position of (Picked unit))) Less than or equal to 250.00
            • Then - Actions
              • Unit - Remove Invulnerable (Neutral) from (Picked unit)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of (Picked unit)) Equal to Uranium
                • Then - Actions
                  • Unit - Kill (Triggering unit)
                • Else - Actions
            • Else - Actions
      • Custom script: call RemoveLocation(udg_loc)
      • Custom script: call DestroyGroup (udg_Investigate_Group)
I've been trying to optimize this trigger not to leak, but I think it still does in this part. If it does leak, how do I go about achieving a similar effect without it leaking?
  • If - Conditions
    • (Distance between loc and (Position of (Picked unit))) Less than or equal to 250.00
  • Then - Actions
 
Last edited:
  • Investigate
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Investigate Rocks
    • Actions
      • Set Investigate_Group = (Units in (Playable map area))
      • Set loc = (Position of (Triggering unit))
      • Unit Group - Pick every unit in Investigate_Group and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
            • Then - Actions
              • Set loc2 = (Position of (Picked unit))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Distance between loc and loc2) Less than or equal to 250.00
                • Then - Actions
                  • Unit - Remove Invulnerable (Neutral) from (Picked unit)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Unit-type of (Picked unit)) Equal to Uranium
                    • Then - Actions
                      • Unit - Kill (Triggering unit)
                    • Else - Actions
                • Else - Actions
              • Custom script: call RemoveLocation(udg_loc2)
            • Else - Actions
      • Custom script: call RemoveLocation(udg_loc)
      • Custom script: call DestroyGroup (udg_Investigate_Group)
It shouldn't leak now, right? :)
 
Oh I see what I was doing wrong, argh I'm tired lol. I thought the if/then/else was stuck to the loop.
Thanks again for the help :)

  • Investigate
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Investigate Rocks
    • Actions
      • Set Investigate_Group = (Units in (Playable map area))
      • Set loc = (Position of (Triggering unit))
      • Unit Group - Pick every unit in Investigate_Group and do (Actions)
        • Loop - Actions
          • Set loc2 = (Position of (Picked unit))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Distance between loc and loc2) Less than or equal to 250.00
            • Then - Actions
              • Unit - Remove Invulnerable (Neutral) from (Picked unit)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of (Picked unit)) Equal to Uranium
                • Then - Actions
                  • Unit - Kill (Triggering unit)
                • Else - Actions
            • Else - Actions
          • Custom script: call RemoveLocation(udg_loc2)
      • Custom script: call RemoveLocation(udg_loc)
      • Custom script: call DestroyGroup (udg_Investigate_Group)
 
Last edited:
I'm not sure what you're talking about. All you would have to do is this:

  • Investigate
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Investigate Rocks
    • Actions
      • Set Investigate_Group = (Units in (Playable map area))
      • Set loc = (Position of (Triggering unit))
      • Unit Group - Pick every unit in Investigate_Group and do (Actions)
        • Loop - Actions
          • Set loc2 = (Position of (Picked unit))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Distance between loc and loc2) Less than or equal to 250.00
            • Then - Actions
              • Unit - Remove Invulnerable (Neutral) from (Picked unit)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of (Picked unit)) Equal to Uranium
                • Then - Actions
                  • Unit - Kill (Triggering unit)
                • Else - Actions
            • Else - Actions
          • Custom script: call RemoveLocation(udg_loc2)
      • Custom script: call RemoveLocation(udg_loc)
      • Custom script: call DestroyGroup (udg_Investigate_Group)
 
Good eye LordDz. I had made this trigger 6 years ago and that explains why it wouldn't work sometimes because the after-cast channel was being interrupted despite the spell actually going off.

Oh boy, optimizing old triggers. Fun.
 
Status
Not open for further replies.
Back
Top