1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still haven't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. Lead your forces to battle in the 15th Techtree Contest. The call is yours, commander!
    Dismiss Notice
  4. The reforging of the races is complete. Come see the 14th Techtree Contest Results.
    Dismiss Notice
  5. It's time to choose your horse in the race - the 32nd Modeling Contest Poll is up!
    Dismiss Notice
  6. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Things That Leak

Discussion in 'Triggers & Scripts' started by Ralle, Jun 10, 2007.

  1. Razorbrain

    Razorbrain

    Joined:
    Aug 18, 2006
    Messages:
    1,165
    Resources:
    1
    Maps:
    1
    Resources:
    1
    help me maybe?
     
  2. Silvenon

    Silvenon

    Joined:
    Nov 22, 2006
    Messages:
    1,233
    Resources:
    1
    Tutorials:
    1
    Resources:
    1
    It should be call RemoveRect(udg_Region), not RemoveLocation, I suppose udg_Region is not a location :)
     
  3. Razorbrain

    Razorbrain

    Joined:
    Aug 18, 2006
    Messages:
    1,165
    Resources:
    1
    Maps:
    1
    Resources:
    1
    oh, thank you

    +rep
     
  4. Diablo-dk

    Diablo-dk

    Joined:
    Nov 10, 2004
    Messages:
    369
    Resources:
    3
    Maps:
    1
    Spells:
    1
    Tutorials:
    1
    Resources:
    3
    A little update to this..

    I've done some researching about sounds in GUI..And you should NOT destroy them.

    When you play a sound in GUI, you just start the sound.

    Destroying it would result in that you would not be able to play the sound again, as you are just removing a global sound.

    Sounds does only have to be destroyed when you create it as a local:
    Code (vJASS):

        local sound s=CreateSound(blablabla)
     
     
  5. Pyritie

    Pyritie

    Joined:
    Nov 26, 2006
    Messages:
    11,356
    Resources:
    60
    Models:
    30
    Icons:
    9
    Packs:
    3
    Skins:
    12
    Tools:
    1
    Maps:
    1
    Tutorials:
    4
    Resources:
    60
    Ah! That might've caused problems. Now is that using the custom script remove sound or just the Destroy sound in GUI?
     
  6. Diablo-dk

    Diablo-dk

    Joined:
    Nov 10, 2004
    Messages:
    369
    Resources:
    3
    Maps:
    1
    Spells:
    1
    Tutorials:
    1
    Resources:
    3
    Destroying the sound in GUI is the same as destroying a sound in jass. So no, don't destroy them, Unless they are local.. which they aren't in GUI.
     
  7. Pyritie

    Pyritie

    Joined:
    Nov 26, 2006
    Messages:
    11,356
    Resources:
    60
    Models:
    30
    Icons:
    9
    Packs:
    3
    Skins:
    12
    Tools:
    1
    Maps:
    1
    Tutorials:
    4
    Resources:
    60
    Well... that could explain why my map's sounds are causing bugs...
     
  8. Lingonberryjam

    Lingonberryjam

    Joined:
    Feb 25, 2005
    Messages:
    230
    Resources:
    0
    Resources:
    0
    Havent got an answer on this yet...

    Heres a new question aswell. Using those two triggers you will find that the second one will not work.

    • Text1
      • Events
        • Time - Elapsed game time is 5.00 seconds
      • Conditions
      • Actions
        • Set tempGroup = (All players)
        • Game - Display to tempGroup the text: Hello!
        • Custom script: call DestroyForce(udg_tempGroup)

    • Text2
      • Events
        • Time - Elapsed game time is 10.00 seconds
      • Conditions
      • Actions
        • Set tempGroup = (All players)
        • Game - Display to tempGroup the text: Hello again!
        • Custom script: call DestroyForce(udg_tempGroup)


    So. Does the custom script really destroy the playergroup variable itself, meaning i cant use it no more?

    What even wierder is that after using the first trigger (Text1), i cant use this one:

    • Events
      • Time - Elapsed game time is 10.00 seconds
      • Conditions
      • Actions
        • Game - Display to (All players) the text: Hello again!


    So. Does the custom script even remove the WE variable (All players) ???
     
  9. Pyritie

    Pyritie

    Joined:
    Nov 26, 2006
    Messages:
    11,356
    Resources:
    60
    Models:
    30
    Icons:
    9
    Packs:
    3
    Skins:
    12
    Tools:
    1
    Maps:
    1
    Tutorials:
    4
    Resources:
    60
    Hmmm... I think destroying a unit group renders it unusable, as my spell that uses a unit group only worked once.
     
  10. Diablo-dk

    Diablo-dk

    Joined:
    Nov 10, 2004
    Messages:
    369
    Resources:
    3
    Maps:
    1
    Spells:
    1
    Tutorials:
    1
    Resources:
    3
    Destroying the force doesn't destroy the variable, only the force it pointed out to.

    (All Players) Returns a global force, meaning it should NOT be destroyed.
    By destroying (All Players) you will not be able to use it again.. that's why the text isn't being shown again.

    When the group is destroyed it's gone(not the variable). But it is only neccesery to destroy it if you have to set the variable to a new group more than once.
     
    Last edited: Jul 26, 2007
  11. Silvenon

    Silvenon

    Joined:
    Nov 22, 2006
    Messages:
    1,233
    Resources:
    1
    Tutorials:
    1
    Resources:
    1
    I don't know why do people who are answering to these kind of threads always ignore the old question and starts answering the new one, but nvm. This won't leak, don't worry. It's important that you understand why: When you store a location in a variable, and you use that variable later, you're always using the same location.

    And Lingonberryjam, please pay attention:

     
  12. SamNainocard

    SamNainocard

    Joined:
    May 17, 2007
    Messages:
    102
    Resources:
    2
    Maps:
    2
    Resources:
    2
    Does
    • Set Temp_TargetPosition48 = (Position of XXX)
    • Set Temp_TargetPosition48 = (Temp_TargetPosition48 offset by 200.00 towards (Facing of XXX) degrees)
    • Do something
    • Custom script: call RemoveLocation(udg_Temp_TargetPosition48)

    0 Leak or 1 leak?

    oh and does
    • Unit - Create 1 Footman for (Owner of XXX) at Temp_TargetPosition48 facing 0.00 degrees

    at (Owner of XXX) is leak or not?
     
    Last edited: Sep 2, 2007
  13. Diablo-dk

    Diablo-dk

    Joined:
    Nov 10, 2004
    Messages:
    369
    Resources:
    3
    Maps:
    1
    Spells:
    1
    Tutorials:
    1
    Resources:
    3
    the first trigger does leak 1 location.

    The other one doesn't leak.
     
  14. PurplePoot

    PurplePoot

    Joined:
    Dec 14, 2005
    Messages:
    11,161
    Resources:
    3
    Maps:
    1
    Spells:
    1
    Tutorials:
    1
    Resources:
    3
    If you destroy (All Players), from then on it'll be equivelant to ForForce'ing 'null'.

    ...which is why you only destroy the unit group when you're done with it. If you use another Get Units in blahblahblah, it should work fine again until it's destroyed again.
     
  15. HamzahA

    HamzahA

    Joined:
    Jul 24, 2007
    Messages:
    310
    Resources:
    3
    Maps:
    2
    Tutorials:
    1
    Resources:
    3
    what about regions? should we remove them after setting into variable?
     
  16. PurplePoot

    PurplePoot

    Joined:
    Dec 14, 2005
    Messages:
    11,161
    Resources:
    3
    Maps:
    1
    Spells:
    1
    Tutorials:
    1
    Resources:
    3
    Not if they preexist on the map. (If you initially placed it)

    In general:

    -IF A VARIABLE IS SET TO AN EXISTING OBJECT then it should not be destroyed
    -IF A VARIABLE IS SET TO A FUNCTION then it should be destroyed.

    Exceptions;

    -Playable Map Area should not be destroyed.
    -All Players should not be destroyed.
     
  17. Pyritie

    Pyritie

    Joined:
    Nov 26, 2006
    Messages:
    11,356
    Resources:
    60
    Models:
    30
    Icons:
    9
    Packs:
    3
    Skins:
    12
    Tools:
    1
    Maps:
    1
    Tutorials:
    4
    Resources:
    60
    What about Entire Map? I'm guessing the same goes for that too.
     
  18. PurplePoot

    PurplePoot

    Joined:
    Dec 14, 2005
    Messages:
    11,161
    Resources:
    3
    Maps:
    1
    Spells:
    1
    Tutorials:
    1
    Resources:
    3
    Nope, actually.

    [jass=Explanation]native GetWorldBounds takes nothing returns rect
    function GetEntireMapRect takes nothing returns rect
    return GetWorldBounds()
    endfunction

    //vs

    function GetPlayableMapRect takes nothing returns rect
    return bj_mapInitialPlayableArea
    endfunction[/jass]

    As you can see, Playable Map Area returns a global variable while Entire Map calls a function to create a rect.
     
  19. HamzahA

    HamzahA

    Joined:
    Jul 24, 2007
    Messages:
    310
    Resources:
    3
    Maps:
    2
    Tutorials:
    1
    Resources:
    3
    does : "Pick every unit in region and do actions" leak?!!
    *the region is an existing object
     
  20. Razorbrain

    Razorbrain

    Joined:
    Aug 18, 2006
    Messages:
    1,165
    Resources:
    1
    Maps:
    1
    Resources:
    1
    the group leaks, not the region

    use
    • Custom Script: set bj_wantDestroyGroup = true