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

[Trigger] Leaking Trigger and I have no Idea how to fix it

Status
Not open for further replies.
Level 7
Joined
Sep 8, 2011
Messages
211
Okay so I have 4 variables in this example.

1 - A_Player_Unit - This is a unit variable.
2 - A_Aggro_Player - This is a player variable.
3 - A_Range_Aggro - This is a unit variable.
4 - A_Aggroing_Player - This is a player variable.

So basically what this trigger does is detects any neutral passive units within units of player 1, changes the neutral passive unit to player 8, removes the wander spell and orders the player 8 unit to attack the player 1 unit.

  • Range Aggro
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Set A_Player_Unit = (Random unit from (Units owned by (Random player from A_Aggro_Player)))
      • Set A_Range_Aggro = (Random unit from (Units within 300.00 of (Position of A_Player_Unit)))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (A_Player_Unit has buff Wind Walk) Equal to False
        • Then - Actions
          • Player Group - Pick every player in A_Aggro_Player and do (Actions)
            • Loop - Actions
              • Set A_Triggering_Player = (Picked player)
          • Player Group - Pick every player in A_Aggroing_Player and do (Actions)
            • Loop - Actions
              • Set A_Changing_Player = (Picked player)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Owner of A_Player_Unit) Equal to A_Triggering_Player
                  • (Owner of A_Range_Aggro) Equal to A_Changing_Player
                • Then - Actions
                  • Unit - Remove Wander (Neutral) from A_Range_Aggro
                  • Unit - Change ownership of A_Range_Aggro to Player 8 (Pink) and Change color
                  • Unit - Order A_Range_Aggro to Attack A_Player_Unit
                • Else - Actions
        • Else - Actions
The two lines
  • Set A_Player_Unit = (Random unit from (Units owned by (Random player from A_Aggro_Player)))
  • Set A_Range_Aggro = (Random unit from (Units within 300.00 of (Position of A_Player_Unit)))
Leak, and I don't know how I can destroy them using destroygroup or anything. Anyone know how to?

Here is a link (http://www.hiveworkshop.com/forums/spells-569/aggro-system-v1-1-a-229468/) to the system and the other triggers if you need to see them.

Thanks for your time.
 
Level 1
Joined
Feb 1, 2013
Messages
5
Maybe you can use this, you can create new unit group variables called TempUnitGroup1 and TempUnitGroup2 for example


  • Set TempUnitGroup1 = (Units owned by (Random player from A_Aggro_Player))
  • Set A_Player_Unit = (Random unit from (TempUnitGroup1))
  • Set TempUnitGroup2 = (Units within 300.00 of (Position of A_Player_Unit))
  • Set A_Range_Aggro = (Random unit from (TempUnitGroup2))


and then add some custom script to remove the leak from unit group


  • Custom script: call DestroyGroup(udg_TempUnitGroup1)
  • Custom script: call DestroyGroup(udg_TempUnitGroup2)
 
Status
Not open for further replies.
Top