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

Simple leak question

Status
Not open for further replies.
Level 5
Joined
Jun 18, 2011
Messages
79
****Condition****

(Distance between (Position of (Attacked unit)) and (Position of (Attacking unit))) Less than or equal to 400.00

***************


I have average to above average knowledge of leaks and removing them, but how about checking the points in a condition?

If you use this kind of a condition does it create a leak? Would really appreciate the support, working on a new map.
 
Level 9
Joined
Nov 19, 2011
Messages
516
In general you don't need to afraid about leaks if you are using your mind when making triggers. Just be sure that you are not typing something stupid like:

Position of (Attacking Unit)

When there is no unit.

Therefore engine may take last unit assigned to this pointer instead of returning null.
 
Level 4
Joined
Jan 28, 2013
Messages
74
Whether "Attacking Unit" exists or not doesn't actually matter: if you get the location of it, it will still leak.

I think MajorKaza was trying to say that as long as the trigger works if it leaks a little bit its not that big of a deal. Not saying I support his idea.
 
Level 9
Joined
Nov 19, 2011
Messages
516
apocalypse is correct.

I mean that if you are refering to unit that does not exist all its pointers are not cleared.

e.g.:

trigger
events - unit enters region
conditions
actions
{
Create 1 unit of unit type(buying unit) at center of <area>
}

In that case you should get no unit. But you may get last stored buying unit as well. So you must check all available trigger release moments. If you are new with scripting (or you didn't made anything using pointers) it is recommended to destroy all pointers when they are not needed anymore.
 
Well, leaks aren't bound to anything :D.
They pop into existence every time you use a location/unit group/special effect/...
Since that condition uses locations, it also creates leaks. That's just the way it is :).
Actually to correct you..
They pop into existence every time you use a new location/unit group/special effect/...
:)
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
I was trying to simplify it a little here :p. Might as well type a DSG-version, but that won't help the new people (actually, I don't think I can type like him :( ).
Also, 'new' is an ambiguous word. If you use "Center of Rect" 2 times, then 2 leaks will be created, despite it not really being a new location the second time (Warcraft will still see it as a new location though).
But you're right. At least, I can't say you're wrong :).

I've written a more detailed (yet still simplified) explanation here, where I say:
Stuff leaks the moment it has been created, but you can't access it anymore.
Which is kinda what Maker said.
 
Status
Not open for further replies.
Top