• 🏆 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] Leakless?

Status
Not open for further replies.
Level 6
Joined
May 29, 2009
Messages
75
I just read the basic memory leak tutorial and tried to fix a spell of mine.

  • Rotation
    • Ereignisse
      • Zeit - Every 0.01 seconds of game time
    • Bedingungen
    • Aktionen
      • Einheitengruppe - Pick every unit in (Units of type Chargeball [dummy]) and do (Actions)
        • Schleifen - Aktionen
          • Set Temp_Group = (Last created unit group)
          • Einheit - Set the custom value of (Picked unit) to ((Custom value of (Picked unit)) - 3)
          • Einheit - Move (Picked unit) instantly to ((Position of caster[(Player number of (Owner of (Picked unit)))]) offset by (Leben of (Picked unit)) towards (Real((Custom value of (Picked unit)))) degrees)
          • Custom script: call DestroyGroup( udg_Temp_Group )
Will it work as it should?

Thanks in advance
Nugamentum
 
Level 7
Joined
Dec 31, 2005
Messages
712
It still leaks a location when you use Position of caster[...].
Try setting this position to a variable, using the variable instead of that and then removing the location with RemoveLocation( udg_yourlocation )

Also, I don't know if that Temp_Group removes the leak. I'd suggest you to use set bj_wantDestroyGroup = true right before the "einheitengruppe" action xD

This will destroy the generated unit group.
 
Level 7
Joined
Mar 8, 2009
Messages
360
  • Untitled Trigger 001
    • Events
      • Time - Every 0.01 seconds of game time
    • Conditions
    • Actions
      • Set tempGroup = (Units of type Blood Mage)
      • Unit Group - Pick every unit in tempGroup and do (Actions)
        • Loop - Actions
          • Unit - Set the custom value of (Picked unit) to ((Custom value of (Picked unit)) - 3)
          • Set tempPoint = (Position of (Triggering unit))
          • Unit - Move (Picked unit) instantly to tempPoint, facing (Real((Custom value of (Picked unit))) degrees
          • Custom script: call RemoveLocation(udg_tempPoint)
      • Custom script: call DestroyGroup( udg_tempGroup )
i think this has less leaks then your trigger
 
Level 6
Joined
May 29, 2009
Messages
75
right before the "einheitengruppe" action xD

Sorry for that :p It's the german version of the game ;)

Thanks for the suggestions

My final Trigger now looks like this:

  • Rotation
    • Ereignisse
      • Zeit - Every 0.01 seconds of game time
    • Bedingungen
    • Aktionen
      • Set Temp_Group = (Units of type Chargeball [dummy])
      • Einheitengruppe - Pick every unit in Temp_Group and do (Actions)
        • Schleifen - Aktionen
          • Einheit - Set the custom value of (Picked unit) to ((Custom value of (Picked unit)) - 3)
          • Set Temp_Point = (Position of caster[(Player number of (Owner of (Picked unit)))])
          • Einheit - Move (Picked unit) instantly to (Temp_Point offset by (Leben of (Picked unit)) towards (Real((Custom value of (Picked unit)))) degrees)
          • Custom script: call RemoveLocation(udg_Temp_Point)
      • Custom script: call DestroyGroup( udg_Temp_Group)
 
Last edited:
Level 11
Joined
Oct 13, 2005
Messages
233
You're still leaking a location. (Temp_Point offset by (Leben of (Picked unit)) towards (Real((Custom value of (Picked unit)))) degrees) is the location that you are not removing in your trigger. In your case, you will need 2 location variables total to handle all the location leaks in the trigger.
 
Level 6
Joined
May 29, 2009
Messages
75
It's a complex way to do something so simple.
The "pick every unit" action destroys the group it creates inside it's code if set bj_wantDestroyGroup = true is used right before it. So, why bother creating a new unit group if it will be destroyed after being used?

I tryed it but it did not worked the chargeball dummy did not rotated around the caster, i dont know why

You're still leaking a location. (Temp_Point offset by (Leben of (Picked unit)) towards (Real((Custom value of (Picked unit)))) degrees) is the location that you are not removing in your trigger. In your case, you will need 2 location variables total to handle all the location leaks in the trigger.

Yes your're gonna change this
 
Status
Not open for further replies.
Top