• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Leak check makes my brain leak -.-

Status
Not open for further replies.
Level 28
Joined
Mar 25, 2008
Messages
2,955
Hi all,
one question:
it constantly says "Location leak" if i say
  • Actions
    • Special effect - Create a special effect at (Random point in (Region centered at (Position of tornado) with size (1500.00, 1500.00))) using Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl
    • Special effect - Create a special effect at (Random point in (Region centered at ^Leak
BUT i defined at the beginning of the trigger the following
  • Actions:
    • Set tornado = (Casting unit)
can somebody tell me why LC says, it leaks?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
Ciebron, thats a type mismatch (error) as you are using remove location on a unit (makes no sense).

Random point in (Region centered at (Position of tornado) with size (1500.00, 1500.00))

Leaks 2 locations.

Position of tornado is one.
Random point in . . . is the other.
 
Level 11
Joined
Apr 6, 2008
Messages
760
oh thought it was a point... and how to fix that is easy

make 2 point variable lets call it X and Y

  • set X = (Position of tornado)
  • set Y = (Center of (Region centered at (X) with size (1500.00, 1500.00)))
im not sure if it 100% correct since i dont do gui rly ^^
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
Well you can eithor swith to using 2 separate X and Y opperators which means no leaks will occur as plain numbers do not leak.

Or you can use "call RemoveLocation(The created location object)" on them.

For the second way you will need to store them in location variables.
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
so that means i need to set for every casting unit (here tornado) a point and for every special effect define a point to keep leaks small or what?
that would suck

It means that whenever you use a pointer (a variable that "points" to other variables, for example - a location points to two coordinates of x,y), you will have to destroy it later on UNLESS it points to values that will never change.

For example, pointing to a player is fine without destroying it, because player 1 will always be player 1.

Now, since we said a point (location) variable is a pointer, you will need to destroy it each time you use it.
When you use "Position of(...)" , "Random point ...", you actually MAKE a point (location) VALUE.
This means that you just made a pointer, without ANY way to ever touch it, which means that if the x,y of it changes, the pointer will stay there and the game engine will create a new one.

This is why you must make a variable for each pointer you use - so you can destroy it when it is not needed.

About your specific question - in GUI most people make two points. One at the unit's location, and one with Polar distance from it (that "x distance, y angle, from ---).
To destroy it, you use the custom script "call RemoveLocation(udg_LocationName)". Notice that this is case sensitive ("s" isn't "S" for example).
You must use that "udg" before any global variable you make (via the variable editor). A space is a downline "_", not " ".


And if you think this sucks, you might as well not do anything that was written here. Just don't wonder if no one will play your map because it would lag.
 
Level 28
Joined
Mar 25, 2008
Messages
2,955
Well, the map doesn't lagg as far as i know.
And thx for the explanation - but what's with the action
Special effect - Destroy (last created special effect) ?
Does wc only destroy the graphic of the special effect and leaves the point where it was created or is it completely removed after the action?
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
Well, the map doesn't lagg as far as i know.
And thx for the explanation - but what's with the action
Special effect - Destroy (last created special effect) ?
Does wc only destroy the graphic of the special effect and leaves the point where it was created or is it completely removed after the action?

Destroying an effect only removes the model of the effect. To remove the location leak, create the effect at a point variable and destroy both of them later on.
 
It isn't too much work. Watch, I'll fix your leak right now:
  • Your trigger
  • Events
  • -- YOUR EVENT(S) --
  • Conditions
  • -- YOUR CONDITION(S) --
  • Actions
    • set TempPoint1 = (Position of tornado)
    • set TempPoint2 = Region Centered At TempPoint1
    • set TempPoint3 = Random Point in (Region centered at TempPoint1)
    • Special effect - Create a special effect at TempPoint3 with size (1500.00, 1500.00))) using Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl
    • Special Effect - Destroy (Last Created Special Effect)
    • Custom Script: call RemoveLocation(udg_TempPoint1)
    • Custom Script: call RemoveLocation(udg_TempPoint2)
    • Custom Script: call RemoveLocation(udg_TempPoint3)
Simply create 3 location variables named TempPoint1, TempPoint2, and TempPoint3 then use this code. Replace the "YOUR EVENTS" and "YOUR CONDITIONS" with your events and conditions, and you'll have a leak free code. :thumbs_up:
 
Level 28
Joined
Mar 25, 2008
Messages
2,955
It isn't too much work. Watch, I'll fix your leak right now:
  • Your trigger
  • Events
  • -- YOUR EVENT(S) --
  • Conditions
  • -- YOUR CONDITION(S) --
  • Actions
    • set TempPoint1 = (Position of tornado)
    • set TempPoint2 = Region Centered At TempPoint1
    • set TempPoint3 = Random Point in (Region centered at TempPoint1)
    • Special effect - Create a special effect at TempPoint3 with size (1500.00, 1500.00))) using Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl
    • Special Effect - Destroy (Last Created Special Effect)
    • Custom Script: call RemoveLocation(udg_TempPoint1)
    • Custom Script: call RemoveLocation(udg_TempPoint2)
    • Custom Script: call RemoveLocation(udg_TempPoint3)
Simply create 3 location variables named TempPoint1, TempPoint2, and TempPoint3 then use this code. Replace the "YOUR EVENTS" and "YOUR CONDITIONS" with your events and conditions, and you'll have a leak free code. :thumbs_up:
Yummi ^^ seems i got to +rep u too.
What i meant with "work" was: i got about 20 triggers built up like that and all are above 50 Lines.. but whatever, i'll do my best ^^
 
Status
Not open for further replies.
Top