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

[Trigger] Memory leak QUestion/help needed

Status
Not open for further replies.
Level 10
Joined
Apr 3, 2006
Messages
535
Im starting to learn about memory leaks and iw ish to go back into my map and fix a few leaks, and I have a question.

I used the memopry leak dector and I found that a comman trigger of mine generates leaks, heres the trigger:

(Line: 12 ) (Word: 10 ) Position Leak
Unit - Create 1 Wriggler for Neutral Hostile at (Random point in Region 009 <gen>) facing Default building facing degrees
Unit - Create 1 Wriggler for Neutral Hostile at ^Leak
(Suggested fix) Set L = (Random point in Region 009 <gen>) facing Default building facing degrees
(Suggested fix) Custom Script: Call RemoveLocation(udg_L)

So im trying to use the custom script, but it doesn’t work, when I puit Custom Script: Call RemoveLocation(udg_L) at the end. So could someone explain how this works, thanks.


Is the (udg_L) part the region or the variable being used. My overall trigger looks like this now and doest work

spawn corpese arena
Events
Time - Every 60.00 seconds of game time
Conditions
Actions
Set duelareanaspawn = Region 387 <gen>
Unit - Create a Town Guard corpse for Neutral Hostile at (Random point in Region 387 <gen>)
Unit - Create a Town Guard corpse for Neutral Hostile at (Random point in Region 387 <gen>)
Unit - Create a Town Guard corpse for Neutral Hostile at (Random point in Region 387 <gen>)
Unit - Create a Town Guard corpse for Neutral Hostile at (Random point in Region 387 <gen>)
Unit - Create a Town Guard corpse for Neutral Hostile at (Random point in Region 387 <gen>)
Unit - Create a Town Guard corpse for Neutral Hostile at (Random point in Region 387 <gen>)
Custom script: Call RemoveLocation(duelarenaspawn)
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
udg_L is a variable that is called L. The "udg" means that you made it in the Variable Editor (don't remember the words it mean).

You probably don't know about Jass, but lets say "RemoveLocation" takes a location variable, and removes it.
Therefor, inside the bracets "()" you need to "give" it a location=point variable.

Lets say you created in the Variable Editor a point variable called Point, your value in the bracets will be (udg_Point), spaces do not matter, eg: ( udg_Point ), but its case sensitive !
So, if your point was named "Point", you cannot type udg_point, you must type udg_Point.
 
Level 10
Joined
Apr 3, 2006
Messages
535
Ok i think i understand, to confirm, i make a region a point variable. Say i call the point variable "arena" (i would say region x - but this may confuse the thread)

So overall i put:
Custom Script: Call RemoveLocation(udg_arena)

i also need to set the arena variable at the start of the trigger aswell.

Hopefully i have grapsed this, please correct if wrong, also thanks for the replys
 
Level 10
Joined
Apr 3, 2006
Messages
535
that may explain why it still isnt working i have this now:

spawn corpese arena
Events
Time - Every 60.00 seconds of game time
Conditions
Actions
Set Point = (Random point in Region 387 <gen>)
Unit - Create a Town Guard corpse for Neutral Hostile at Point
Custom script: Call RemoveLocation(udg_Point)

but i get a code error, im gonna try your suggestion of the capital "C" for call and see what happens.
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
calls are "call", function names go with a capital in each word, for exampe KillUnit, GetEnumUnits, and not killunit, getenumunits.

Values you give the function (inside the bracets ()) depend on the value type, for example a variable will be named like the variable, functions such as GetTriggerUnit() (and all the rest of them) are just like normal functions, units on the map are called if im not mistake gg_unit_UNITNAME, they are kinda weird.

Anyway, go learn Jass, GUI sucks :p
 
Level 10
Joined
Apr 3, 2006
Messages
535
Thanks for all the help guys ive got it sussed :), Ghostwolf Jass is a little to advanced for me at this stage i think ill stick to using simple variables untill im a little more advanced :)
 
Status
Not open for further replies.
Top