• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[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:
Level 37
Joined
Jul 22, 2015
Messages
3,485
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