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

Need help with leaking trigger.

Status
Not open for further replies.
Level 6
Joined
May 31, 2008
Messages
218
I need help to fix this trigger. I don't know anything about leaks but leakchecker told me this leaked cause of the position that is not in a variable. So i wonder how to fix this, cause i tried and it didn't work.

  • Gold
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • Set regional_capitol[0] = (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Region capitol))
      • Unit Group - Pick every unit in regional_capitol[0] and do (Actions)
        • Loop - Actions
          • Set gold_horse[0] = (Units within 100.00 of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Gold Horse))
          • Unit Group - Pick every unit in gold_horse[0] and do (Actions)
            • Loop - Actions
              • Unit - Remove (Picked unit) from the game
              • Unit Group - Remove all units of gold_horse[0] from gold_horse[0]
              • Custom script: call DestroyGroup (udg_gold_horse[0])
              • Player - Add 20 to (Owner of (Picked unit)) Current gold
          • Unit Group - Remove all units of regional_capitol[0] from regional_capitol[0]
          • Custom script: call DestroyGroup (udg_regional_capitol[0])
 
Level 8
Joined
Apr 7, 2008
Messages
176
  • Gold
  • Events
  • Time - Every 0.50 seconds of game time
  • Conditions
  • Actions
  • Set regional_capitol[0] = (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Region capitol))
  • Unit Group - Pick every unit in regional_capitol[0] and do (Actions)
  • Loop - Actions
  • Set gold_horse[0] = (Units within 100.00 of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Gold Horse))
  • Unit Group - Pick every unit in gold_horse[0] and do (Actions)
  • Loop - Actions
  • Unit - Remove (Picked unit) from the game
  • Unit Group - Remove all units of gold_horse[0] from gold_horse[0]
  • Custom script: call DestroyGroup (udg_gold_horse[0])
  • Player - Add 20 to (Owner of (Picked unit)) Current gold
  • Unit Group - Remove all units of regional_capitol[0] from regional_capitol[0]
  • Custom script: call DestroyGroup (udg_regional_capitol[0])
Okay...well.

First the leak you asked about. Its the Position of the picked unit, when you ask for all units within 100 of position of picked unit. You need to set its position to a variable, then remove that variable.
call RemoveLocation (udg_VARIABLE)

Also, Im wondering Y you have all those variables as arrays... Are they used again? Looks like they are just set to null every time. So Y?
You're probably re-using the variables in other triggers with a different array arent u? Just for simplicity sake.

And... Umm.. yea, You have a loop that shouldnt work. The one that removes the horses. You have it picking every horse and removing all the units in the Golden Horse group. So when it picks the first unit, Immediately afterwards it will remove all the units in the unit group. Which Im guessing is Y you have the time interval set so damn low, because as it is if you set it to 5 like that other guy said, some horses could escape, but if you wait till the end of the trigger to remove all units from the group then that interval could be raised.
 
Status
Not open for further replies.
Top