• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Solved] leaks in distance check condition?

Status
Not open for further replies.
Level 4
Joined
Aug 17, 2008
Messages
81
  • 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:
Level 4
Joined
Aug 17, 2008
Messages
81
  • 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? :)
 
Level 4
Joined
Aug 17, 2008
Messages
81
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)
 
Status
Not open for further replies.
Top