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

Leaks ?

Status
Not open for further replies.
Level 33
Joined
Mar 27, 2008
Messages
8,035
Situation 1:
  • Actions
    • Special Effect - Create a special effect attached to the overhead of (Triggering unit) using Abilities\Spells\Other\TalkToMe\TalkToMe.mdl
    • Special Effect - Destroy (Last created special effect)
I know it's not the SFX is leaking, I am asking that if the "attached to the overhead of..." is leaking
Well, it is a "create-something-at-something" function, right ?
I mean, does this count as "location/point" ?

Situation 2:
This ?
  • Actions
    • Custom script: set bj_wantDestroyGroup
    • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
      • Loop - Actions
        • Set PickedLoc = (Position of (Picked unit))
        • Custom script: call RemoveLocation(udg_PickedLoc)
Or this ?
  • Actions
    • Custom script: set bj_wantDestroyGroup
    • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
      • Loop - Actions
        • Set PickedLoc = (Position of (Picked unit))
    • Custom script: call RemoveLocation(udg_PickedLoc)
Situation 3:
This ?
  • Actions
    • Set UnitGroup = (Units in (Playable map area))
    • Unit Group - Pick every unit in UnitGroup and do (Actions)
      • Loop - Actions
        • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + 25.00)
    • Custom script: call DestroyGroup(udg_UnitGroup)
Or this ?
  • Unit Group - Add (Triggering unit) to UnitGroup
  • Actions
    • Unit Group - Pick every unit in UnitGroup and do (Actions)
      • Loop - Actions
        • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + 25.00)
    • Wait 5.00 seconds
    • Unit Group - Remove all units from UnitGroup
Situation 4:
  • Actions
    • Player Group - Pick every player in (All players) and do (Actions)
      • Loop - Actions
Some say that this action does not leak, then what's the use of this ?
  • Custom script: call DestroyForce(udg_Variable)
Situation 5 (general question):
  • Events
    • Map initialization
  • Events
    • Time - Elapsed game time is 0.00 seconds
Do they have difference ?

NOTE: I'm showing examples of situation, so don't comment on the efficiency of the trigger "hey, you're using Wait, n00b"
Please, don't
Keep it short and simple, thank you :D
 
Situation 1:
  • Actions
    • Special Effect - Create a special effect attached to the overhead of (Triggering unit) using Abilities\Spells\Other\TalkToMe\TalkToMe.mdl
    • Special Effect - Destroy (Last created special effect)
I know it's not the SFX is leaking, I am asking that if the "attached to the overhead of..." is leaking
Well, it is a "create-something-at-something" function, right ?
I mean, does this count as "location/point" ?

Nope, it is a hardcoded native for attachment. (or at least the function that BJ executes)

Situation 2:
This ?
  • Actions
    • Custom script: set bj_wantDestroyGroup
    • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
      • Loop - Actions
        • Set PickedLoc = (Position of (Picked unit))
        • Custom script: call RemoveLocation(udg_PickedLoc)
Or this ?
  • Actions
    • Custom script: set bj_wantDestroyGroup
    • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
      • Loop - Actions
        • Set PickedLoc = (Position of (Picked unit))
    • Custom script: call RemoveLocation(udg_PickedLoc)

The first one won't leak. The second one will. Each time you create a new handle, and the variable serves as a reference to it. When you set it to something else, then the variable just points to something else, but that previous location still is there in memory. :)

Situation 3:
This ?
  • Actions
    • Set UnitGroup = (Units in (Playable map area))
    • Unit Group - Pick every unit in UnitGroup and do (Actions)
      • Loop - Actions
        • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + 25.00)
    • Custom script: call DestroyGroup(udg_UnitGroup)
Or this ?
  • Unit Group - Add (Triggering unit) to UnitGroup
  • Actions
    • Unit Group - Pick every unit in UnitGroup and do (Actions)
      • Loop - Actions
        • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + 25.00)
    • Wait 5.00 seconds
    • Unit Group - Remove all units from UnitGroup

They both won't leak. #2 will usually be more efficient (depending on how many times that trigger is run) but it is a bit more rare to find a situation that warrants that in GUI. It depends. :p By that, I mean that it is better to use one global group constantly, but generally it is a bit harder and can become less efficient when done in GUI opposed to JASS, so it is usually okay to just stick with #1.

Situation 4:
  • Actions
    • Player Group - Pick every player in (All players) and do (Actions)
      • Loop - Actions
Some say that this action does not leak, then what's the use of this ?
  • Custom script: call DestroyForce(udg_Variable)

DestroyForce() is for custom-defined forces. All players is pre-defined to contain all the players, so you don't need to destroy it unless you want to. Destroying it will simply make it have no value unless you create that force again. Pick Every player won't use memory, but creating a custom force will. So generally, you should destroy it if it is a custom force that you no longer need to use. (one you made)

Situation 5 (general question):
  • Events
    • Map initialization
  • Events
    • Time - Elapsed game time is 0.00 seconds
Do they have difference ?

The first fires while the map is loading, the second fires upon the game starting.

Hopefully this all makes sense. :ogre_haosis:
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Nope, it is a hardcoded native for attachment. (or at least the function that BJ executes)
Okay.


The first one won't leak. The second one will. Each time you create a new handle, and the variable serves as a reference to it. When you set it to something else, then the variable just points to something else, but that previous location still is there in memory. :)
So, the Custom script should be included IN the Loop - Actions, eh ?


They both won't leak. #2 will usually be more efficient (depending on how many times that trigger is run) but it is a bit more rare to find a situation that warrants that in GUI. It depends. :p By that, I mean that it is better to use one global group constantly, but generally it is a bit harder and can become less efficient when done in GUI opposed to JASS, so it is usually okay to just stick with #1.
So, I have to create a unit Group and destroy it over and over again ?
Well, I think that if we doesn't "create" variable in a trigger, serves a faster/better efficiency
If we are to create a variable, we're wasting 2 lines of action which is "creation" and "destroy"


DestroyForce() is for custom-defined forces. All players is pre-defined to contain all the players, so you don't need to destroy it unless you want to. Destroying it will simply make it have no value unless you create that force again. Pick Every player won't use memory, but creating a custom force will. So generally, you should destroy it if it is a custom force that you no longer need to use. (one you made)
Same goes to Unit Group, right ?
If we create a Unit Group variable, we should input the Custom script
If we're not, we just input the set bj_wantDestroyGroup = true, right ?


The first fires while the map is loading, the second fires upon the game starting.
I was asking about its "efficiency", sorry not to be details :D
Which one should we use for faster/better efficiency ?
Loading Time | Starting Game
Hopefully this all makes sense. :ogre_haosis:

Nope, it is a hardcoded native for attachment. (or at least the function that BJ executes)
Okay.

The first one won't leak. The second one will. Each time you create a new handle, and the variable serves as a reference to it. When you set it to something else, then the variable just points to something else, but that previous location still is there in memory. :)
So, the Custom script should be included IN the Loop - Actions, eh ?

They both won't leak. #2 will usually be more efficient (depending on how many times that trigger is run) but it is a bit more rare to find a situation that warrants that in GUI. It depends. :p By that, I mean that it is better to use one global group constantly, but generally it is a bit harder and can become less efficient when done in GUI opposed to JASS, so it is usually okay to just stick with #1.
So, I have to create a unit Group and destroy it over and over again ?
Well, I think that if we doesn't "create" variable in a trigger, serves a faster/better efficiency
If we are to create a variable, we're wasting 2 lines of action which is "creation" and "destroy"

DestroyForce() is for custom-defined forces. All players is pre-defined to contain all the players, so you don't need to destroy it unless you want to. Destroying it will simply make it have no value unless you create that force again. Pick Every player won't use memory, but creating a custom force will. So generally, you should destroy it if it is a custom force that you no longer need to use. (one you made)
Same goes to Unit Group, right ?
If we create a Unit Group variable, we should input the Custom script
If we're not, we just input the set bj_wantDestroyGroup = true, right ?

The first fires while the map is loading, the second fires upon the game starting.
Hopefully this all makes sense. :ogre_haosis:
I was asking about its "efficiency", sorry not to be details :D
Which one should we use for faster/better efficiency ?
Loading Time | Starting Game

And sorry: "You have given too much rep for the last 24 hours. Please try again later."
 
So, the Custom script should be included IN the Loop - Actions, eh ?

Yep.

So, I have to create a unit Group and destroy it over and over again ?
Well, I think that if we doesn't "create" variable in a trigger, serves a faster/better efficiency
If we are to create a variable, we're wasting 2 lines of action which is "creation" and "destroy"

Yeah. It usually will depend on the triggers though. (eg: if you create a trigger just for adding units or something, it might be a bit worse)

Same goes to Unit Group, right ?
If we create a Unit Group variable, we should input the Custom script
If we're not, we just input the set bj_wantDestroyGroup = true, right ?

Yep.

I was asking about its "efficiency", sorry not to be details :D
Which one should we use for faster/better efficiency ?
Loading Time | Starting Game

Most people prefer to have it at map initialization. It does it during load time instead, because otherwise you might get a small freeze for a little bit once the map starts. ;D
 
Status
Not open for further replies.
Top