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

How do i stop this leaking - unit group

Status
Not open for further replies.
Level 10
Joined
Apr 3, 2006
Messages
535
  • Corpse Explosion
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Ability being cast) Equal to Corpse Explosion
        • Then - Actions
          • Unit Group - Pick every unit in (Units in (Region centered at (Target point of ability being cast) with size (250.00, 250.00)) matching ((((Matching unit) is dead) Equal to True) and (((Matching unit) is Mechanical) Equal to False))) and do (Actions)
            • Loop - Actions
              • Animation - Change (Picked unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 100.00% transparency
              • Unit - Replace (Picked unit) with a Corpse Explosion Dummy using The new unit's default life and mana
              • Unit - Change ownership of (Last replaced unit) to (Owner of (Casting unit)) and Retain color
              • Unit - Make (Last replaced unit) Explode on death
              • Unit - Cause (Last replaced unit) to damage circular area after 0.00 seconds of radius 250.00 at (Position of (Picked unit)), dealing (100.00 x (Real((Level of Corpse Explosion for (Casting unit))))) damage of attack type Spells and damage type Normal
              • Unit - Add a 0.01 second Generic expiration timer to (Last created unit)
        • Else - Actions
thanks
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
  • Set Loc = (Target point of ability being cast)
  • Set Group = Pick every unit in (Units in (Region centered at Loc with size (250.00, 250.00)) matching ((((Matching unit) is dead) Equal to True) and (((Matching unit) is Mechanical) Equal to False)))
  • Unit Group - Pick every unit in Group and do (Actions)
    • Loop - Actions
      • Animation - Change (Picked unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 100.00% transparency
      • Unit - Replace (Picked unit) with a Corpse Explosion Dummy using The new unit's default life and mana
      • Unit - Change ownership of (Last replaced unit) to (Owner of (Casting unit)) and Retain color
      • Unit - Make (Last replaced unit) Explode on death
      • Set Loc = (Position of (Picked unit))
      • Unit - Cause (Last replaced unit) to damage circular area after 0.00 seconds of radius 250.00 at Loc, dealing (100.00 x (Real((Level of Corpse Explosion for (Casting unit))))) damage of attack type Spells and damage type Normal
      • Unit - Add a 0.01 second Generic expiration timer to (Last created unit)
  • Custom script: call DestroyGroup(udg_Group)
  • Custom script: call RemoveLocation(udg_Loc)
(Did I miss something?)
 
  • Set Loc = (Target point of ability being cast)
  • Set Group = Pick every unit in (Units in (Region centered at Loc with size (250.00, 250.00)) matching ((((Matching unit) is dead) Equal to True) and (((Matching unit) is Mechanical) Equal to False)))
  • Unit Group - Pick every unit in Group and do (Actions)
    • Loop - Actions
      • Animation - Change (Picked unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 100.00% transparency
      • Unit - Replace (Picked unit) with a Corpse Explosion Dummy using The new unit's default life and mana
      • Unit - Change ownership of (Last replaced unit) to (Owner of (Casting unit)) and Retain color
      • Unit - Make (Last replaced unit) Explode on death
      • Set Loc = (Position of (Picked unit))
      • Unit - Cause (Last replaced unit) to damage circular area after 0.00 seconds of radius 250.00 at Loc, dealing (100.00 x (Real((Level of Corpse Explosion for (Casting unit))))) damage of attack type Spells and damage type Normal
      • Unit - Add a 0.01 second Generic expiration timer to (Last created unit)
  • Custom script: call DestroyGroup(udg_Group)
  • Custom script: call RemoveLocation(udg_Loc)
(Did I miss something?)

You still missed a rect (and a boolexpr, but I don't remember any workaround in GUI) :D

  • [...]
  • Set Region = (Region centered at Loc with size (250.00, 250.00))
  • Set Group = Pick every unit in (Units in Region matching ((((Matching unit) is dead) Equal to True) and (((Matching unit) is Mechanical) Equal to False)))
  • [...]
  • Custom script: call DestroyGroup( udg_Group )
  • Custom script: call RemoveLocation( udg_Loc )
  • Custom script: call RemoveRect( udg_Region )
And some people will come here saying that DestroyGroup leaks xD
 
Level 10
Joined
Apr 3, 2006
Messages
535
thanks for the reply, ive done the location as a point variable now, but i am having trouble witht he unit group one
Set Group = Pick every unit in (Units in (Region centered at Loc with size (250.00, 250.00)) matching ((((Matching unit) is dead) Equal to True) and (((Matching unit) is Mechanical) Equal to False)))

could someone put this in a map for me, sorry to be a pain/useless
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Bahh, you have to learn someday, it isn't really a pain ^^

(Note that I've used an array for the location, since "Point with offset" has 2 locations and you'll probably use that somewhere in your map.
Otherwise you had to change the variable, which would screw all other uses of that variable, including this trigger... it's best to think ahead ^^).
 

Attachments

  • Unit Group.w3x
    13 KB · Views: 43
Last edited:
Level 10
Joined
Apr 3, 2006
Messages
535
ok im a bit more confused now - damn memory leaks confusing me!

So i need to set the variables, then use them?

this is what i have at the moment

  • Corpse Explosion
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Ability being cast) Equal to Unknown (A0C3)
        • Then - Actions
          • Unit Group - Pick every unit in (Units in (Region centered at (Target point of ability being cast) with size (250.00, 250.00)) matching ((((Matching unit) is dead) Equal to True) and (((Matching unit) is Mechanical) Equal to False))) and do (Actions)
            • Loop - Actions
              • Set Loc[1] = (Target point of ability being cast)
              • Set Region = (Region centered at Loc[1] with size (250.00, 250.00))
              • Set Group = (Units in Region matching (((Life of (Matching unit)) Less than 1.00) and (((Matching unit) is Mechanical) Equal to False)))
              • Unit Group - Pick every unit in Group and do (Actions)
                • Loop - Actions
                  • -------- Your Actions (you don't have any problems here, I think). --------
              • Animation - Change (Picked unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 100.00% transparency
              • Unit - Replace (Picked unit) with a using The new unit's default life and mana
              • Unit - Change ownership of (Last replaced unit) to (Owner of (Casting unit)) and Retain color
              • Unit - Make (Last replaced unit) Explode on death
              • Unit - Cause (Last replaced unit) to damage circular area after 0.00 seconds of radius 250.00 at (Position of (Picked unit)), dealing (100.00 x (Real((Level of Unknown (A0C3) for (Casting unit))))) damage of attack type Spells and damage type Normal
              • Unit - Add a 0.01 second Generic expiration timer to (Last created unit)
              • Custom script: call RemoveLocation(udg_Loc[1])
              • Custom script: call RemoveRect(udg_Region)
              • Custom script: call DestroyGroup(udg_Group)
        • Else - Actions
So as far as i can tell i havnt used your variables and im still leaking location/point? and also do i use the unitgroup - pick, or do i use the set unit group? im confused sorry. also thanks very much for your help sp far
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Of course you need to use variables:
You first need to assign the leaking data to a variable and then clear the variable, so the leak is removed.

You don't get it, I think...
You've put my trigger inside yours, while my trigger IS your trigger, so you should replace it.
You didn't fix any leak in your trigger...

Hold on, I'll edit the map for you, so it's easier to see...

Edit:
Uploaded the map in my previous post. (not everything is exactly the same, but you can change it... the main point is that this is the trigger you need).
 
Level 10
Joined
Apr 3, 2006
Messages
535
thanks ive magaed to upate it now, only problem i have now is adding the [1] part after location = LoC if this makes sense im not sure how to add it into the trigger?

Unit - Cause (Last replaced unit) to damage circular area after 0.00 seconds of radius 250.00 at LoC, dealing (100.00 x (Real((Level of Corpse Explosion for (Casting unit))))) damage of attack type Spells and damage type Normal
 
Status
Not open for further replies.
Top