Quick Question Concerning Leaks

Father_Yetti

New Member
Reaction score
46
If I make a special effect and use points offset from either units or point of ability being cast; do these points clear or have I just created leaks? And if so; how do I clean things up to make it leakless?
 

gameman

It's been a long, long time.
Reaction score
96
Yes they leak, try this

Code:
Actions
    Set point = ((Center of (Playable map area)) offset by 100.00 towards 0.00 degrees)
    Do actions
    Custom script:   call RemoveLocation(udg_point)
 

Samael88

Evil always finds a way
Reaction score
181
Everything that returns a point/location leaks, what I know of.
Code:
Set temppoint = Position of killed unit.
create 1 footman at temppoint
custom script: call RemoveLocation(udg_temppoint)
temppoint is a point variable.
Annd the udg_ stands for UserDefinedGlobal, wich is reffering to that the variable is created in the variable editor:thup:
 

Xorifelse

I'd love to elaborate about discussions...........
Reaction score
87
Yes they leak, try this

Code:
Actions
    Set point = ((Center of (Playable map area)) offset by 100.00 towards 0.00 degrees)
    Do actions
    Custom script:   call RemoveLocation(udg_point)

Yes, they leak. And so does your script.

I don't know what Samael88 said, since I ignored him but here is the code on how it is done.

Code:
Untitled Trigger 001
    Events
    Conditions
    Actions
        Set tempPoint[1] = (Center of (Playable map area))
        Set tempPoint[2] = (tempPoint[1] offset by 512.00 towards 180.00 degrees)
        Unit - Create a Footman corpse for Player 1 (Red) at tempPoint[2]
        Custom script:   call RemoveLocation( udg_tempPoint[1] )
        Custom script:   call RemoveLocation( udg_tempPoint[2] )

As you can see it is quite a large code for just a corpse creating at a polar projection point.
In Jass you are able to do all of this, faster and in 1 line.

Once you understand GUI better, I'd suggest switching over to Jass.
 

Father_Yetti

New Member
Reaction score
46
Yes, they leak. And so does your script.

I don't know what Samael88 said, since I ignored him but here is the code on how it is done.

Code:
Untitled Trigger 001
    Events
    Conditions
    Actions
        Set tempPoint[1] = (Center of (Playable map area))
        Set tempPoint[2] = (tempPoint[1] offset by 512.00 towards 180.00 degrees)
        Unit - Create a Footman corpse for Player 1 (Red) at tempPoint[2]
        Custom script:   call RemoveLocation( udg_tempPoint[1] )
        Custom script:   call RemoveLocation( udg_tempPoint[2] )

As you can see it is quite a large code for just a corpse creating at a polar projection point.
In Jass you are able to do all of this, faster and in 1 line.

Once you understand GUI better, I'd suggest switching over to Jass.

Cool thanks. So are you saying, or does someone else know that the other suggestions given are incorrect? The reason I am asking is because I don't want to have to set all my points to variables as there are a lot of them I have already used in quite a few of my triggers. I know this was noob of me however I am really new to this or I might have thought of it prior. I guess what I am asking is if there is a way to script it without setting variables? Unless that is the only way or is the better way to go about it. Again thanks for the help.

Ooh unless, and this will show how noob I am, you can use one temp point in many different instances? For example set the temp point in relationship to (whatever you want): (x = -128)(y = -200)? And use this anytime you wanted to represent such an offset from either a unit or point, etc?
 

skyblader

You're living only because it's illegal killing.
Reaction score
159
I think it can be used once its set, as long as u wan tht point. But if u set it to a new number, itll be that number(or position, in this case) But if it cant be used over and over again, then i believe i can fix my triggers already.
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
> if there is a way to script it without setting variables?


Unit - Create 1 <whatever> at <somewhere> for <someone> facing Default
Just an example action.
And, well, for that "somewhere" part, there simply is no choice.
You need a point.
It's expected and anything else won't work.
If said point is created dynamically in that very line, you have a leak.

It's no problem to set a point that you really need over and over again to some variable,
once at map init, and use it as often as needed without ever destroying it.
Though if it needs to be "calculated" according to the current events... store it, use it, destroy it.
 

Father_Yetti

New Member
Reaction score
46
> if there is a way to script it without setting variables?


Unit - Create 1 <whatever> at <somewhere> for <someone> facing Default
Just an example action.
And, well, for that "somewhere" part, there simply is no choice.
You need a point.
It's expected and anything else won't work.
If said point is created dynamically in that very line, you have a leak.

It's no problem to set a point that you really need over and over again to some variable,
once at map init, and use it as often as needed without ever destroying it.
Though if it needs to be "calculated" according to the current events... store it, use it, destroy it.
Cool, thanks for explaining. I really appreciate good explanations as I otherwise sometimes don't fully comprehend what others are saying. And even now, lol, let me make sure that I do. This point that you are saying I can set up at map init; it cannot be floating; it has to be fixed %100, say -3500, 256 from center of playable area. Or can I create and set a few defined offsets -128, 128 and 128, -32, where the offset is fixed so that I can use these offsets as they are desired: according to current events? I probably think not but really have no clue as the computer must already know where a unit is during a current event without having to store points to calculate this, but maybe the leak comes in the creating of the offset? I have no idea how this works.

However my next question regardless of that answer is: Can I destroy points without having to set them as variables? I have already created many points for sound, special effects, damage, etc. that are not set as variables; I just entered the desired offsets. How exactly do I do this if it can be done? There seems to be some disagreement above so it is not quite clear to me yet on which way to perform this.

And for efficiencies sake can you clear whole groups or batches of points at once? Anyhow thank you for your time all who have helped. Sorry I don’t quite get it.
 

vypur85

Hibernate
Reaction score
803
> Can I destroy points without having to set them as variables?

No.


> How exactly do I do this if it can be done?

Set variable and remove. You have no choice, you'll just have to rework everything. Refer to the trigger posted in Post#4. It's done correctly.


> efficiencies sake can you clear whole groups or batches of points at once?

No. You need to set them into variable and destroy them (with an exception with Unit Group, but it's still the same, you need to add the destroy script in every trigger).
 

Father_Yetti

New Member
Reaction score
46
Thank you Vyper85 for clarifying that.

Still not sure on this AceHart or others: This point that you are saying I can set up at map init; it cannot be floating; it has to be fixed %100, say -3500, 256 from center of playable area. Or can I create and set a few defined offsets -128, 128 and 128, -32, where the offset is fixed so that I can use these offsets as variables as they are desired from say a triggering unit in multiple triggers, or will they sometimes intertwine and mess one another up?

Do I need distinctly different variables for each trigger even if the offsets are the same. I would think so but I really don't know.

I was also curious if I need a custom script when I make a sound attatched to a triggering unit? Or for any matter then what concerning current events needs to be cleared: groups, points, effects, sounds, all of it? If so what would does each one look like? I tried to set the triggering unit as a point so I could clear it in a custom script and I couldn't figure it out.

Then my other question just to be certain is that these temp_points are all arrays or at least should be? It looks that way from what I can tell. Again thanks guys for the help.
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
There's rarely a good reason for having TempPoints as arrays...
Create more variables.

Either way though, this is beginning to sound like you're having philosophical problems with anti-leaking.
Just do it.
So what if it isn't "mostest perfectest" first try?
If you're really unsure on how to proceed, post an example trigger,
and I'm sure people will flame you to hell and back for every single leak they (think) found.
Ignore the flame, fix it, done.

Get something that works. Worry later.
 

Father_Yetti

New Member
Reaction score
46
There's rarely a good reason for having TempPoints as arrays...
Create more variables.

Either way though, this is beginning to sound like you're having philosophical problems with anti-leaking.
Just do it.
So what if it isn't "mostest perfectest" first try?
If you're really unsure on how to proceed, post an example trigger,
and I'm sure people will flame you to hell and back for every single leak they (think) found.
Ignore the flame, fix it, done.

Get something that works. Worry later.

Yeah its more an understanding I'm trying to get; a philosophy if you will because thats the only way it will make sense to me. I'm not so much worried as I just want to know. But posting example triggers is probably a good idea. thanks.
 

Father_Yetti

New Member
Reaction score
46
How do these Look? I wasn't sure about the PulsarTarget? Can it be cleared via RemoveUnit ( udg_PulsarTarget )? Or would that clear my Hero lol?

Trigger One:

Code:
Events

Unit - A unit Starts the effect of an ability

Conditions

(Ability being cast) Equal to Prism Pulsar Cannon

Actions

Set TempPoint2 = (Position of (Target Unit of ability being cast))
Set X200Y200 = (TempPoint2 offset by (200.00, 200.00))
Set Xn200Yn200 = (TempPoint2 offset by (-200.00, -200.00))
Set Xn200Y200 = (TempPoint2 offset by (-200.00, 200.00))
Set X200Yn200 = (TempPoint2 offset by (200.00, -200.00))
Set X000Yn200 = (TempPoint2 offset by (0.00, -200.00))
Set Xn200Y000 = (TempPoint2 offset by (-200.00, 0.00))
Set Xn000Y200 = (TempPoint2 offset by (0.00, 200.00))
Set X200Y000 = (TempPoint2 offset by (200.00, 0.00))

Set PulsarTarget = (Target unit of ability being cast)

Unit - Cause (Triggering unit) to damage circular area after 1.00 seconds or radius 350 at TemPoint2, dealing 880.00 damage of attack type Chaos and damage type Fire

Countdown Timer - Start PulsarTimer as a One-shot timer that will expire in 1.00 seconds

Set PulsarTimer = (Last started timer)

Trigger Two:

Code:
Events

Time - PulsarTimer expires

Conditions

Actions

Special Effect - Create a special effect at TempPoint2 using Objects\Spawnmodels\Other\NeutralBuildingExplosion\NeutralBuildingExplosion.mdl
Special Effect - Create a special effect at X200Y200 using Objects\Spawnmodels\Other\NeutralBuildingExplosion\NeutralBuildingExplosion.mdl
Special Effect - Create a special effect at Xn200Yn200 using
Objects\Spawnmodels\Other\NeutralBuildingExplosion\NeutralBuildingExplosion.mdl
Special Effect - Create a special effect at Xn200Y200 using
Objects\Spawnmodels\Other\NeutralBuildingExplosion\NeutralBuildingExplosion.mdl
Special Effect - Create a special effect at X200Yn200 using
Objects\Spawnmodels\Other\NeutralBuildingExplosion\NeutralBuildingExplosion.mdl
Special Effect - Create a special effect at X000Yn200 using
Objects\Spawnmodels\Other\NeutralBuildingExplosion\NeutralBuildingExplosion.mdl
Special Effect - Create a special effect at Xn200Y000 using
Objects\Spawnmodels\Other\NeutralBuildingExplosion\NeutralBuildingExplosion.mdl
Special Effect - Create a special effect at X000Y200 using
Objects\Spawnmodels\Other\NeutralBuildingExplosion\NeutralBuildingExplosion.mdl
Special Effect - Create a special effect at X200Y000 using Objects\Spawnmodels\Other\NeutralBuildingExplosion\NeutralBuildingExplosion.mdl

Sound - Play NightElfBuildingDeathLarge1 <gen> at 100.00% volume, attached to PulsarTarget

Destructable - Pick every destructible within 330 of TempPoint2 and do (Destructible - Kill(Picked destructible))

Custom script: call RemoveLocation( udg_TempPoint2 )
Custom script: call RemoveLocation( udg_X200Y200 )
Custom script: call RemoveLocation( udg_Xn200Yn200 )
Custom script: call RemoveLocation( udg_Xn200Y200 )
Custom script: call RemoveLocation( udg_X200Yn200 )
Custom script: call RemoveLocation( udg_X000Yn200 )
Custom script: call RemoveLocation( udg_Xn200Y000 )
Custom script: call RemoveLocation( udg_X000Y200 )
Custom script: call RemoveLocation( udg_X200Y000 )
 

vypur85

Hibernate
Reaction score
803
> Can it be cleared via RemoveUnit ( udg_PulsarTarget )

'call RemoveUnit' is simply 'Unit - Remove YourUnit' in GUI, which you don't want to do it because it basically removes your unit. Unit variables in global GUI do not leak. You do not need to null or remove it. Both your triggers do not leak. However, if cast 2 times quickly within 1 second, it will leak. Just use your imagination... (Points will be created 2 times and only one set will be removed, the other will be overwritten).

Edit (for post below):
My bad. Was focusing on point variables >.<...
 

Father_Yetti

New Member
Reaction score
46
> Both your triggers do not leak

What about the special effects?

> Set PulsarTimer = (Last started timer)

A nonsense line. Remove it.

Please someone explain on the special effects? I still don't know if I have leaks or not.

Set PulsarTimer = (Last started timer): is this ever used? I was just copying something I saw in another trigger, but yeah I can see how it is set here:
Countdown Timer - Start PulsarTimer as a One-shot timer that will expire in 1.00 seconds
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
Well, every "special effect - create" also needs a "special effect - destroy".

On most effects, you can simply add the "destroy" right after the create.
 

Father_Yetti

New Member
Reaction score
46
Well, every "special effect - create" also needs a "special effect - destroy".

On most effects, you can simply add the "destroy" right after the create.

So this handles the leak without needing any custom script? As well you say most effects; is there a distinction between different effects and how they will handle. I have noticed that if you destroy some effects they don't even have time to finish animating; while others I have destroyed and they never leave the map. I'm thinking this might be because I am spawning them in .2 second intervals? Can you create a special effect and then use a wait command and then destroy it? I've done this before but don't know if it takes care of the leak still or not becuase the special effect just stayed there.
 

Flare

Stops copies me!
Reaction score
662
Some special effects aren't really 'instant' e.g. most buffs, so if you create it, and immediately destroy it, you don't see much, except perhaps a little "blip".

Something like Thunder Clap, War Stomp, explosions, those kinda effects, they can be created and immediately destroyed, since the effect will still follow through until the end of it's animation before being removed fully

You could use a very simple script like
JASS:
function TimedEffectSimple takes location loc, string model, real duration returns nothing
  local effect e = AddSpecialEffectLoc (model, loc) //Not sure about parameter order, it could be location, string
  call TriggerSleepAction (duration)
  call DestroyEffect (e)
  set e = null
endfunction

if you want a buff effect to last for a period of time, although it's not very accurate if you want something to last EXACTLY # seconds
 

Father_Yetti

New Member
Reaction score
46
Some special effects aren't really 'instant' e.g. most buffs, so if you create it, and immediately destroy it, you don't see much, except perhaps a little "blip".

Something like Thunder Clap, War Stomp, explosions, those kinda effects, they can be created and immediately destroyed, since the effect will still follow through until the end of it's animation before being removed fully

Cool thanks Flare. K, thats what I've notices when using buffs like purge and what not. However I still really desire graphically some buffs over abilities or explosions. Can a wait command be issued in order to allow the buff to play out a bit before destroying it?

===oh more====

Cool Flare thanks. I haven't really done any scripting yet except to remove leaks but I will have to try this one out, thanks.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top