wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Tutorials > Trigger (GUI)/ AI editor Tutorials
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 06-28-2004, 12:24 PM   #31
Cubasis
User


Respected User
 
Join Date: Sep 2002
Posts: 633

Submissions (1)

Cubasis is on a distinguished road (15)

Default

Erhm,

Yes, they both leak too. And you just use the exact same methods to take care of those leaks as I explained in the first post. Catch it into a temp variable. Use it, Destroy it.

~Cubasis
Cubasis is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 06-28-2004, 02:54 PM   #32
-={tWiStÄr}=-
User
 
Join Date: Nov 2002
Posts: 1,108

-={tWiStÄr}=- is on a distinguished road (20)

Default

wow... if we still had points then a great thing to get like a million points would be to go through and fix everyones memory leaks.
P.S. check out the new subject icons o_O
-={tWiStÄr}=- is offline   Reply With Quote
Old 06-29-2004, 02:42 PM   #33
raejin
User
 
Join Date: Oct 2003
Posts: 44

raejin has little to show at this moment (0)

Default

Nice tutorial man, thanks for taking the time to write it!
raejin is offline   Reply With Quote
Old 07-05-2004, 07:42 AM   #34
DISTURBING_PEON
User
 
Join Date: Jan 2004
Posts: 11

DISTURBING_PEON has little to show at this moment (0)

Default

If i explode a unit, do i need to remove it still? I am using something along the line of a unit enters region explode sorceress.
DISTURBING_PEON is offline   Reply With Quote
Old 07-05-2004, 03:13 PM   #35
Cubasis
User


Respected User
 
Join Date: Sep 2002
Posts: 633

Submissions (1)

Cubasis is on a distinguished road (15)

Default

I heard that ExplodeUnit clears it out of memory, so it causes no memory leak. However, I have never tested or even used this function, so I can't really confirm that.

~Cubasis
Cubasis is offline   Reply With Quote
Old 07-08-2004, 03:21 AM   #36
mutevampire
User
 
Join Date: Jun 2004
Posts: 20

mutevampire has little to show at this moment (0)

Default

Would this cause memory leakage? I have a trigger-enhanced spell that's set up so that when unit summons Dark Rider of War, it centers the rect called Riders on the summoned Dark Rider of War then 'summons' 3 more dark riders (Death, Plague, Famine) at polar offsets to the center of the rect (where the Dark Rider of War stands)
mutevampire is offline   Reply With Quote
Old 07-09-2004, 08:53 PM   #37
ChaosWolfs
User
 
Join Date: Jan 2003
Posts: 129

ChaosWolfs has little to show at this moment (1)

Default

Does this cause memory leaks?

Pick every unit in Pathing[1] and issue order to "PICKED UNIT" to attack-move to TeamCastle[2]
Custom Script: call DestroyGroup( udg_Pathing[1] )
Custom Script: call RemoveRect( udg_TeamCastle[2] )

Im having a feeling "picked unit" does.......
ChaosWolfs is offline   Reply With Quote
Old 07-10-2004, 01:14 AM   #38
-={tWiStÄr}=-
User
 
Join Date: Nov 2002
Posts: 1,108

-={tWiStÄr}=- is on a distinguished road (20)

Default

@ChaosWolfs: actually no leak there. you actually shouldnt have destroyed those points because theyre globals and you may need them later.

@mutevampire: yes.. the origin point leaks, and then the final point. so you need to use a var for the origin and then instead of making the units at the polar offset you need to set the point to a variable and then create the units at the var.

and finaly..
@someone smarter than me: eh... were both of those answers right?
-={tWiStÄr}=- is offline   Reply With Quote
Old 07-13-2004, 12:25 PM   #39
Cubasis
User


Respected User
 
Join Date: Sep 2002
Posts: 633

Submissions (1)

Cubasis is on a distinguished road (15)

Default

Twistar, that's pretty much correct.

Although, Chaoswolf seems to be working with a "Rect" (TeamCastle[2]), and he can't order units to actually move to those, he has to get the center of it (a location) for that action to work, and that's a location he needs to deal with propperly. And yes, you don't really need to remove the rect if it's a global.

And mutevampire, i'll just quote myself:

Quote:
EVERY time...when you are making an action and you open up one of those GUI window labeled "Point" and select something in it "except" a variable a point will be created for you, but will "leak" becouse you don't catch it and dispose of it when you're done.

and now i'll quote you:

Quote:
at polar offsets to the center of the rect

So, as (Polar Offsets) AND (Center of Rect) are both actions inside the Point window. They will both leak.... except if you grab them into a variable and destroy them afterwards. I thought I had made it very clear in the article.

~Cubasis
Cubasis is offline   Reply With Quote
Old 07-20-2004, 11:36 AM   #40
ELNINO
User
 
Join Date: Apr 2004
Posts: 21

ELNINO has little to show at this moment (0)

Default

If i have several spawn triggers that trigger at the exact same time, and i do this:

- Set TempRect = SpawnAllies1
- Remove TempRect

If i do this in another triger at exactly the same time, will it make a difference? If so can i use arrays to change it?
When setting the variable and removing it with custom script, does the variable name have to be say temppoint, or TempRect, or TempGRoup (or whatevers written there) ?

Thanks in advance :)
ELNINO is offline   Reply With Quote
Old 07-20-2004, 01:28 PM   #41
Cubasis
User


Respected User
 
Join Date: Sep 2002
Posts: 633

Submissions (1)

Cubasis is on a distinguished road (15)

Default

Firstly, I don't really understand completely what you're doing and stuff.

But... Triggers can not run at the exact same time. That is, if they do, one trigger will run completely (or up to a Wait action), then the next will run etc.

And lol, the variable name can be ANYTHING ;P, I just chose Temp<type> as a example name. If you create a variable in the editor, it's "real" name (in jass) is: udg_<ChosenName>

If you want to remove a location in a array, you do this: call RemoveLocation( udg_MyLocArray[0] )

Replacing whatever index you want.

~Cubasis
Cubasis is offline   Reply With Quote
Old 07-20-2004, 11:25 PM   #42
0siris[GoE]
User
 
Join Date: Apr 2003
Posts: 53

0siris[GoE] has little to show at this moment (0)

Default

yes it will. If you have trigger that use the same variable at the same time, they'll overact. Use arrays instead, e.g. YourVar[1] = Center of bla.

No the variable can have any name.
0siris[GoE] is offline   Reply With Quote
Old 07-21-2004, 07:49 AM   #43
ELNINO
User
 
Join Date: Apr 2004
Posts: 21

ELNINO has little to show at this moment (0)

Default

Thanks, that helps
:D
ELNINO is offline   Reply With Quote
Old 01-08-2005, 12:48 AM   #44
oNdizZ
User
 
oNdizZ's Avatar
 
Join Date: Jul 2004
Posts: 526

Submissions (2)

oNdizZ will become famous soon enough (33)oNdizZ will become famous soon enough (33)

Default

(Warning! note that i've never ever used jass except the simple : call removeLocation)

First off :

why can't you just use something like:

Custom script: call removeLocation( (GetUnitLoc(GetAttackedUnitBJ())) )

why does it have to be a variable?

Second:

Code:
Chidori Power
    Events
        Unit - A unit Is attacked
    Conditions
        (Unit-type of (Attacking unit)) Equal to Chidori (Lightning Edge) (Lightning) C
    Actions
        Unit - Order (Attacking unit) to damage (Attacked unit) for ((Life of (Attacked unit)) / 10.00) using attack type Chaos and damage type Lightning.
        Special Effect - Create a special effect attached to the chest of (Attacked unit) using Abilities\Weapons\Bolt\BoltImpact.mdl
        Unit - Move (Attacked unit) instantly to ((Position of (Attacked unit)) offset by 10.00 towards (Angle from (Position of (Attacked unit)) to (Position of (Attacking unit))) degrees)

I know this leaks, but how does it work? shall i just take away the Locations AFTER the last action? or after every action that has a leak in it? Couse i need the locations in all actions. hmm i can take another example:

This would be a triggered (with GUI) spell
Code:
Event : unit casts an ability
Cond: ability being cast = ExampleAbility
Actions:
-Set TempLocation[playernumber of owner of casting unit] = bla bla bla
-For each (Integer A) from 1 to 2, do (Actions)
    Loop - Actions
        Unit - Create 1 Footman for Player 1 (Red) at (TempLocation[playernumber ...]) facing Default building facing (270.0) degrees
        Wait 2 seconds
        Custom Script: Call Remove( udg_TempLocation[playernum...] )

If i would do like this, there would not be any temploc[blablabla] at the seconds time in the loop, and if i put the "Set TempLocation = bla bla bla" in the loop, it would change if the unit would move and it would be kinda messy if you want the units to stand at a specific place from the Caster.

Anyway, how do you think i should do to make the "Chidori Power" trigger non-leaky?

thx on advance

(Edit:) Third:
Custom script: Call RemoveLocation( udg_WaterCannonTempPoint )

i get the error message expected a code statement

what have i missed?
__________________

In need of a Macromedia Flash script tutor.

RIP - L2Extreme

Last edited by oNdizZ : 01-08-2005 at 01:13 AM. Reason: one other thing
oNdizZ is offline   Reply With Quote
Old 01-27-2005, 01:56 PM   #45
wiebbe
User
 
Join Date: Jul 2002
Posts: 67

wiebbe has little to show at this moment (0)

Default

Ok, even though this is a old topic, it can use a small kick to help new guys with leaks? I just tghout i would answer these questions:

Quote:
Originally Posted by oNdizZ
(Warning! note that i've never ever used jass except the simple : call removeLocation)

First off :

why can't you just use something like:

Custom script: call removeLocation( (GetUnitLoc(GetAttackedUnitBJ())) )

why does it have to be a variable?

Second:


Well, the answer is quite simple, When you call GetUnitLoc(GetAttackedUnitBJ()) it creates a location in the memory without a handle you can all again. So when its called the first time, in ie a loop, it creates a Location, and when you call:

call removeLocation( (GetUnitLoc(GetAttackedUnitBJ())) )

it creates the location, and then instantly removes it. its kinda useless this way ;)

Quote:
Code:
Chidori Power
    Events
        Unit - A unit Is attacked
    Conditions
        (Unit-type of (Attacking unit)) Equal to Chidori (Lightning Edge) (Lightning) C
    Actions
        Unit - Order (Attacking unit) to damage (Attacked unit) for ((Life of (Attacked unit)) / 10.00) using attack type Chaos and damage type Lightning.
        Special Effect - Create a special effect attached to the chest of (Attacked unit) using Abilities\Weapons\Bolt\BoltImpact.mdl
        Unit - Move (Attacked unit) instantly to ((Position of (Attacked unit)) offset by 10.00 towards (Angle from (Position of (Attacked unit)) to (Position of (Attacking unit))) degrees)

I know this leaks, but how does it work? shall i just take away the Locations AFTER the last action? or after every action that has a leak in it? Couse i need the locations in all actions.


Yes, well, iam not quite sure, but it doesnt really matter when you remove the variables from the memory.. ie, if you remove then after they are used its the same if you remove them at the end of the trigger.

So you could do it like this:
Code:
Chidori Power
    Events
        Unit - A unit Is attacked
    Conditions
        (Unit-type of (Attacking unit)) Equal to Chidori (Lightning Edge) (Lightning) C
    Actions
        Unit - Order (Attacking unit) to damage (Attacked unit) for ((Life of (Attacked unit)) / 10.00) using attack type Chaos and damage type Lightning.
        Special Effect - Create a special effect attached to the chest of (Attacked unit) using Abilities\Weapons\Bolt\BoltImpact.mdl
        Set Variable - temp_chidori_attacked = (Position of (Attacked unit)
        Set Variable - temp_chidori_attacking = (Position of (Attacking unit)
        Unit - Move (Attacked unit) instantly to (temp_chidori_attacked) offset by 10.00 towards (temp_chidori_attacked) to (temp_chidori_attacking) degrees)
        --- Comment - Clean up all leaks ---
         Remove Location - temp_chidori_attacked
         Remove Location - temp_chidori_attacking
Now basicly, i think you should catch the SpecialEffect in a variable too, and destroy that one afterwads too. But this could make some errors because if would have to include a wait, and then the variables could be set by a new trigger still creating leaks :P

But it would look like this:
Quote:
Special Effect - Create a special effect attached to the chest of (Attacked unit) using Abilities\Weapons\Bolt\BoltImpact.mdl
set Variable - temp_chidoriSFX = Last created Special Effect
Wait 1.00 Second
Custom Script: call DestroyEffect( udg_temp_chidoriSFX )
Now, iam nite sure if WEU has a Remove Special Effect that actually removes it without leaking, so i use the custom code one here. You could try last created special effect, but this would have the same error, (ie with the wait it could be different already, locals would fix this, but iam not sure if they work in gui :P)
But this would solve leaking.


Quote:
hmm i can take another example:

This would be a triggered (with GUI) spell
Code:
Event : unit casts an ability
Cond: ability being cast = ExampleAbility
Actions:
-Set TempLocation[playernumber of owner of casting unit] = bla bla bla
-For each (Integer A) from 1 to 2, do (Actions)
    Loop - Actions
        Unit - Create 1 Footman for Player 1 (Red) at (TempLocation[playernumber ...]) facing Default building facing (270.0) degrees
        Wait 2 seconds
        Custom Script: Call Remove( udg_TempLocation[playernum...] )

If i would do like this, there would not be any temploc[blablabla] at the seconds time in the loop, and if i put the "Set TempLocation = bla bla bla" in the loop, it would change if the unit would move and it would be kinda messy if you want the units to stand at a specific place from the Caster.

Anyway, how do you think i should do to make the "Chidori Power" trigger non-leaky?

thx on advance

This is quite simple, you can place the remove location just after the loop? it doesnt have to be inside the loop, just remove it afterwards!

Quote:
(Edit:) Third:
Custom script: Call RemoveLocation( udg_WaterCannonTempPoint )

i get the error message expected a code statement

what have i missed?
i honestly have no idea :P
wiebbe is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 04:53 AM.


Affiliates
The Hubb The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2019, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services