Triggers - Memory Leaks and Custom Scripts

OST(Norway)

New Member
Reaction score
0
If I use one variable in many situations, do I need to remove the leaks?
For example in a loop.

-Loop
----Set Temp_Point = (Random point in (Playable map area))
----Create unit at Temp_Point....
-Call RemoveLocation (udg_Temp_Point)

Do I have to place the "leak remover" in the loop?
 

mapguy

New Member
Reaction score
46
Custom script: call DestroyTimer( udg_Your_Variable ) //Countdown Timer

I have to destroy a countdow timer everytime it expires and then create it again, or I just have to destroy It if I'm not going to use it again?
 

Jedi

New Member
Reaction score
63
Just destroy it once if you are not going to use it again.You don't need to destroy timers in GUI.
 

tooltiperror

Super Moderator
Reaction score
231
In GUI you have... global variables. Which means you can reuse them. So if you are over writing the timer, why destroy it? I the leak from the timer at the end of the game will likely be under 4 mb, somewhere around there. If you have a lot of timers, recycle.
 

SerraAvenger

Cuz I can
Reaction score
234
Imagine a hotel (the memory), and lots of little rooms (to put stuff inside like "position of <unit>").
Now, people check in, rooms are busy... everything's just normal.
However, they simply leave without checking out.
At some point, the hotel will appear full even though no one's in.

"The master" has spoken.
All bow in front of "the master".
 

tooltiperror

Super Moderator
Reaction score
231
"The master" has spoken.
All bow in front of "the master".

Perhaps a better analogy would be memory is the hotel and locations are the rooms in the hotel. Clearing the Leak is checking out, and simply leaving is removing from the game. Even if you remove them from the game, when someone else comes to check in, they can't, because the space is used up. Unfortunately, this space can be outside of WC3.
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Yes, that is correct...

Show the entire trigger, please ;)


FAIL XD
Was looking at another page of this, and replied to that question XD

@ ToolTipError: Well, that is what he wrote, isn't it ?! :S
And it would be better to say the the rooms are the different types of data you can store, and the people checking in are the data to be stored as these different types :D
Then also, of course, if they check out when they leave (Are removed), a leak isn't created, otherwise it is :D
 

SerraAvenger

Cuz I can
Reaction score
234
Then also, of course, if they check out when they leave (Are removed), a leak isn't created, otherwise it is :D

The leak is created while you code. What you mean is that memory is leaked.

Memory is leaked when the last reference to the memory is destroyed. It is like forgetting about the memory.

Also what the master has been talking about was handle id leaks, not memory leaks :D
 

colinjames13

New Member
Reaction score
0
Abilities casted at the same time

:confused:Please Help!!
Most of my abilities in my map has lots of dummy units. All of them have expiration timers already but when two heroes cast abilities with dummy units at the same time, the two heroes like switched abilities or something. Sorry if I can't explain it well.
 

colinjames13

New Member
Reaction score
0
Here are the triggers:



blade beam
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Blade Beam
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Unit-type of (Casting unit)) Equal to Elesis
Then - Actions
Set bbpoint = (Target point of ability being cast)
Set bbunit = (Casting unit)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Blade Beam for (Casting unit)) Equal to 1
Then - Actions
Unit - Create 1 blade beam for (Owner of bbunit) at (Position of bbunit) facing Default building facing degrees
Set bbdummy = (Last created unit)
Animation - Play bbunit's attack animation
Unit - Add a 1.00 second Generic expiration timer to bbdummy
Unit - Order bbdummy to Attack Ground bbpoint
Wait 0.50 seconds
Animation - Reset bbunit's animation
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Blade Beam for (Casting unit)) Equal to 2
Then - Actions
Unit - Create 1 blade beam2 for (Owner of bbunit) at (Position of bbunit) facing Default building facing degrees
Set bbdummy = (Last created unit)
Animation - Play bbunit's attack animation
Unit - Add a 1.00 second Generic expiration timer to bbdummy
Unit - Order bbdummy to Attack Ground bbpoint
Wait 0.50 seconds
Animation - Reset bbunit's animation
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Blade Beam for (Casting unit)) Equal to 3
Then - Actions
Unit - Create 1 blade beam3 for (Owner of bbunit) at (Position of bbunit) facing Default building facing degrees
Set bbdummy = (Last created unit)
Animation - Play bbunit's attack animation
Unit - Add a 1.00 second Generic expiration timer to bbdummy
Unit - Order bbdummy to Attack Ground bbpoint
Wait 0.50 seconds
Animation - Reset bbunit's animation
Else - Actions
Else - Actions




The other ability:



burstshot
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Burst Shot
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Unit-type of (Casting unit)) Equal to Lire
Then - Actions
Set o = (Casting unit)
Set tl = (Target point of ability being cast)
For each (Integer A) from 1 to 50, do (Actions)
Loop - Actions
Animation - Change o's animation speed to 1000.00% of its original speed
Unit - Create 1 burst Shot for (Owner of (Casting unit)) at (Position of (Casting unit)) facing Default building facing degrees
Set o2 = (Last created unit)
Unit - Add a 0.50 second Generic expiration timer to o2
Unit - Order o2 to Attack Ground (tl offset by (Random real number between 0.00 and 256.00) towards (Random real number between 0.00 and 360.00) degrees)
Unit - Create 1 burst Shot for (Owner of (Casting unit)) at ((Position of (Casting unit)) offset by 128.00 towards 0.00 degrees) facing Default building facing degrees
Set o3 = (Last created unit)
Unit - Add a 0.50 second Generic expiration timer to o3
Unit - Order o3 to Attack Ground (tl offset by (Random real number between 0.00 and 256.00) towards (Random real number between 0.00 and 360.00) degrees)
Unit - Create 1 burst Shot for (Owner of (Casting unit)) at ((Position of (Casting unit)) offset by 128.00 towards 90.00 degrees) facing Default building facing degrees
Set o3_Copy = (Last created unit)
Unit - Add a 0.50 second Generic expiration timer to o3_Copy
Unit - Order o3_Copy to Attack Ground (tl offset by (Random real number between 0.00 and 256.00) towards (Random real number between 0.00 and 360.00) degrees)
Unit - Create 1 burst Shot for (Owner of (Casting unit)) at ((Position of (Casting unit)) offset by 128.00 towards 180.00 degrees) facing Default building facing degrees
Set o3_Copy_2 = (Last created unit)
Unit - Add a 0.50 second Generic expiration timer to o3_Copy_2
Unit - Order o3_Copy_2 to Attack Ground (tl offset by (Random real number between 0.00 and 256.00) towards (Random real number between 0.00 and 360.00) degrees)
Unit - Create 1 burst Shot for (Owner of (Casting unit)) at ((Position of (Casting unit)) offset by 128.00 towards 270.00 degrees) facing Default building facing degrees
Set o3_Copy_3 = (Last created unit)
Unit - Add a 0.50 second Generic expiration timer to o3_Copy_3
Unit - Order o3_Copy_3 to Attack Ground (tl offset by (Random real number between 0.00 and 256.00) towards (Random real number between 0.00 and 360.00) degrees)
Unit - Create 1 burst Shot for (Owner of (Casting unit)) at ((Position of (Casting unit)) offset by 256.00 towards 0.00 degrees) facing Default building facing degrees
Set o3_Copy_4 = (Last created unit)
Unit - Add a 0.50 second Generic expiration timer to o3_Copy_4
Unit - Order o3_Copy_4 to Attack Ground (tl offset by (Random real number between 0.00 and 384.00) towards (Random real number between 0.00 and 360.00) degrees)
Unit - Create 1 burst Shot for (Owner of (Casting unit)) at ((Position of (Casting unit)) offset by 256.00 towards 90.00 degrees) facing Default building facing degrees
Set o3_Copy_5 = (Last created unit)
Unit - Add a 0.50 second Generic expiration timer to o3_Copy_5
Unit - Order o3_Copy_5 to Attack Ground (tl offset by (Random real number between 0.00 and 384.00) towards (Random real number between 0.00 and 360.00) degrees)
Unit - Create 1 burst Shot for (Owner of (Casting unit)) at ((Position of (Casting unit)) offset by 256.00 towards 180.00 degrees) facing Default building facing degrees
Set o3_Copy_6 = (Last created unit)
Unit - Add a 0.50 second Generic expiration timer to o3_Copy_6
Unit - Order o3_Copy_6 to Attack Ground (tl offset by (Random real number between 0.00 and 384.00) towards (Random real number between 0.00 and 360.00) degrees)
Unit - Create 1 burst Shot for (Owner of (Casting unit)) at ((Position of (Casting unit)) offset by 256.00 towards 225.00 degrees) facing Default building facing degrees
Set o3_Copy_7 = (Last created unit)
Unit - Add a 0.50 second Generic expiration timer to o3_Copy_7
Unit - Order o3_Copy_7 to Attack Ground (tl offset by (Random real number between 0.00 and 384.00) towards (Random real number between 0.00 and 360.00) degrees)
Unit - Create 1 burst Shot for (Owner of (Casting unit)) at ((Position of (Casting unit)) offset by 256.00 towards 270.00 degrees) facing Default building facing degrees
Set o3_Copy_8 = (Last created unit)
Unit - Add a 0.50 second Generic expiration timer to o3_Copy_8
Unit - Order o3_Copy_8 to Attack Ground (tl offset by (Random real number between 0.00 and 384.00) towards (Random real number between 0.00 and 360.00) degrees)
Animation - Play o's attack animation
Wait 0.01 seconds
Animation - Change o's animation speed to 100.00% of its original speed
Animation - Reset o's animation
Else - Actions



This also happens with other abilities with dummy units, its like the actions of the other trigger transfers with the other?!! I hope u know wat i'm saying.
 

Sui-cookie

You can change this now in User CP.
Reaction score
49
post things like that in the actual help part.... i would have never seen this if i had'nt been looking for more terrain tuts >.>
post it here :thup: im sure someone will be glad to help.
Oh, and use the wc3 trigger thing. It looks like a lowercase A when your writing these.

Now, to relate this post somehow...
Awesome tut? :p lol... it really is, one of the first i ever read... other than the hero creation thing... years ago.... ;) this has helped me, and i hope it helps everyone that has been here/is to come.
 

tonton302

Member
Reaction score
0
what are the custom scripts for codegen save/load??? they wont let me use the save/load system...:banghead:
 

skyblader

You're living only because it's illegal killing.
Reaction score
159
I'm not sure whether I'm allowed to bump this amazing tutorial :p, but I think it'd be better if you added in how to clear leaks in an array, using Loop Integer A. For example there are 20 special effects saved into SpecialEffectVar[1] to [20], it'd be a little tedious to clear them one by one.

I came across this problem myself and had no idea how to replace the 1-20 with the [bj_forLoopAIndex]. Maybe you can add this into your tutorial and make it simpler for newbies llike me around :thup:
 

emjlr3

Change can be a good thing
Reaction score
395
recommend JASS - GUI is so idiotic its not even funny
 

Yoww89

New Member
Reaction score
0
I'm sorry but i didn't get it. Why do i need to store playable map area in a global variable and then remove it when it's already a default world editor variable (can i call it this way? .p) just like triggering unit? PS: My english suc** so it would be great if someone could keep it basic in the explanation. Ty :]
 

dianamod27

Member
Reaction score
1
You don't need to store playable map area. As the tutorial says, using certain functions creates and stores unnecessary data. You need to "catch" that data and remove it or else it will flood your memory.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top