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 havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The Lich King demands your service! We've reached the 19th edition of the Icon Contest. Come along and make some chilling servants for the one true king.
    Dismiss Notice
  4. The 4th SFX Contest has started. Be sure to participate and have a fun factor in it.
    Dismiss Notice
  5. The poll for the 21st Terraining Contest is LIVE. Be sure to check out the entries and vote for one.
    Dismiss Notice
  6. The results are out! Check them out.
    Dismiss Notice
  7. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  8. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  9. 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. Eleandor

    Eleandor

    Joined:
    Aug 21, 2005
    Messages:
    3,681
    Resources:
    2
    Models:
    1
    Tutorials:
    1
    Resources:
    2
    I didn't understand either of you.

    But to your last post: you should just pick all players in seppo.
     
  2. Super-Sheep

    Super-Sheep

    Joined:
    Oct 21, 2006
    Messages:
    2,823
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Then it creates a leak.
    Then I have to remove the leak = player group
    And when the player group is removed, it is destroyed, and all players have to join to the player group again?
     
  3. Justify

    Justify

    Joined:
    Mar 16, 2008
    Messages:
    935
    Resources:
    5
    Models:
    1
    Icons:
    1
    Spells:
    3
    Resources:
    5
    Picking players in a group doesn't leak!
    Creating a player group "leaks". You can't even say a group leaks. A leak is an object in the memory without a reference on it, so you can't use it anymore. You can use a player group a thousand times without increasing the memory used by wc3. But if you use stuff like "pick all players MATCHING" wc3 creates a new group and that leaks :/
    Btw: (All players) doesn't leak, it is a global group that's created on mapinit.
     
  4. Super-Sheep

    Super-Sheep

    Joined:
    Oct 21, 2006
    Messages:
    2,823
    Resources:
    1
    Maps:
    1
    Resources:
    1
    If variables dont leak, why we remove them? :/
     
  5. Eleandor

    Eleandor

    Joined:
    Aug 21, 2005
    Messages:
    3,681
    Resources:
    2
    Models:
    1
    Tutorials:
    1
    Resources:
    2
    Expressions like "units within 512 of a certain location" automatically create a new unit group. Therefor, whenever you use "units within 512 of a certain location" a new unit group is created again and again and never removed and thus leaks.

    In your example, you're never creating any player groups (forces), you're only adding players to the player group and thus you don't leak any player groups.
     
  6. Super-Sheep

    Super-Sheep

    Joined:
    Oct 21, 2006
    Messages:
    2,823
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Picking players from a playergroup doesnt leak? Only adding players to playergroup leak?
     
  7. Justify

    Justify

    Joined:
    Mar 16, 2008
    Messages:
    935
    Resources:
    5
    Models:
    1
    Icons:
    1
    Spells:
    3
    Resources:
    5
    Adding also doesn't leak. The playergroup itself leaks, but I said it already:
    You call it a leak if there is for example a playergroup you are NEVER going to use again. As long as you do this, it's just used memory for wc3. If not, it's wasted memory aka memory leak.
     
  8. Super-Sheep

    Super-Sheep

    Joined:
    Oct 21, 2006
    Messages:
    2,823
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Set point1 = something
    Move unit to something
    Move camera to something
    Destroy something

    OR

    Set point1 = something
    Move unit to something
    Destroy something
    ---
    Set point1 = something
    Move camera to something
    Destroy something

    :s
     
  9. Element of Water

    Element of Water

    Joined:
    Aug 3, 2008
    Messages:
    2,298
    Resources:
    5
    Spells:
    3
    Tutorials:
    1
    JASS:
    1
    Resources:
    5
    First one works fine. It doesn't matter how many times you use the variable, it will not leak as long as you destroy it.

    EDIT: Make sure you're destroying "point1" - not this "something".
     
  10. Super-Sheep

    Super-Sheep

    Joined:
    Oct 21, 2006
    Messages:
    2,823
    Resources:
    1
    Maps:
    1
    Resources:
    1
    I know. Just mistake lol. :D
     
  11. Rvsoldier

    Rvsoldier

    Joined:
    Oct 18, 2007
    Messages:
    141
    Resources:
    0
    Resources:
    0
    I could use some help on a trigger x-x. Been screwing with it for a while now and I can't stop it from leaking. Help would be appreciated.

    • StarBusterSet
      • Events
        • Unit - A unit Starts the effect of an ability
      • Conditions
        • ((Ability being cast) Equal to Divine Buster (A)) or ((Ability being cast) Equal to Starlight Breaker )
      • Actions
        • Trigger - Turn off (This trigger)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Or - Any (Conditions) are true
              • Conditions
                • (Owner of (Casting unit)) Equal to Player 2 (Blue)
                • (Owner of (Casting unit)) Equal to Player 3 (Teal)
                • (Owner of (Casting unit)) Equal to Player 4 (Purple)
                • (Owner of (Casting unit)) Equal to Player 5 (Yellow)
                • (Owner of (Casting unit)) Equal to Player 6 (Orange)
          • Then - Actions
            • Player Group - Add Player 7 (Green) to StarlightPlayerGroup
            • Player Group - Add Player 8 (Pink) to StarlightPlayerGroup
            • Player Group - Add Player 9 (Gray) to StarlightPlayerGroup
            • Player Group - Add Player 10 (Light Blue) to StarlightPlayerGroup
            • Player Group - Add Player 11 (Dark Green) to StarlightPlayerGroup
            • Player Group - Add Player 12 (Brown) to StarlightPlayerGroup
            • Player Group - Add Neutral Hostile to StarlightPlayerGroup
          • Else - Actions
            • Player Group - Add Player 1 (Red) to StarlightPlayerGroup
            • Player Group - Add Player 2 (Blue) to StarlightPlayerGroup
            • Player Group - Add Player 3 (Teal) to StarlightPlayerGroup
            • Player Group - Add Player 4 (Purple) to StarlightPlayerGroup
            • Player Group - Add Player 5 (Yellow) to StarlightPlayerGroup
            • Player Group - Add Player 6 (Orange) to StarlightPlayerGroup
            • Player Group - Add Neutral Hostile to StarlightPlayerGroup


    • Divine Buster New
      • Events
        • Unit - A unit Starts the effect of an ability
      • Conditions
        • (Ability being cast) Equal to Divine Buster (A)
      • Actions
        • Set NanoPoint[2] = (Position of (Casting unit))
        • Set NanoVariables[0] = (Casting unit)
        • Set StarlightCaster = (Casting unit)
        • Unit - Create 1 Divine Buster Dummy for (Owner of NanoVariables[0]) at NanoPoint[2] facing (Target point of ability being cast)
        • Set NanoVariables[2] = (Last created unit)
        • Animation - Play (Triggering unit)'s spell animation
        • Trigger - Turn on Divine Buster Movement <gen>
        • Custom script: call RemoveLocation(udg_NanoPoint[2])


    • Divine Buster Movement
      • Events
        • Time - Every 0.04 seconds of game time
      • Conditions
      • Actions
        • Set DivineDistance = (DivineDistance + 1)
        • Set NanoPoint[3] = (Position of NanoVariables[2])
        • Unit - Move NanoVariables[2] instantly to (NanoPoint[3] offset by 60.00 towards (Facing of NanoVariables[2]) degrees)
        • Unit - Create 1 Divine Buster Dummy for (Owner of NanoVariables[0]) at NanoPoint[3] facing Default building facing (270.0) degrees
        • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
        • Unit Group - To NanohaGroup2 add units near NanoPoint[3] in a range of 300.00 matching (((Owner of (Matching unit)) is in StarlightPlayerGroup) Equal to True)
        • Unit Group - Pick every unit in NanohaGroup2 and do (Actions)
          • Loop - Actions
            • Unit - Cause StarlightCaster to damage (Picked unit), dealing ((0.25 x (Real((Level of Divine Buster (A) for StarlightCaster)))) x (Real((Intelligence of StarlightCaster (Include bonuses))))) damage of attack type Spells and damage type Universal
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • DivineDistance Greater than or equal to 20
          • Then - Actions
            • Unit - Remove NanoVariables[2] from the game
            • Set DivineDistance = 0
            • Unit Group - Pick every unit in NanohaGroup2 and do (Unit Group - Remove (Matching unit) from NanohaGroup2)
            • Custom script: call RemoveLocation(udg_NanoPoint[3])
            • Trigger - Turn off (This trigger)
          • Else - Actions
        • Custom script: call RemoveLocation(udg_NanoPoint[3])
        • Unit Group - Pick every unit in NanohaGroup2 and do (Unit Group - Remove (Matching unit) from NanohaGroup2)
     
  12. SanKakU

    SanKakU

    Joined:
    May 11, 2008
    Messages:
    1,183
    Resources:
    1
    Maps:
    1
    Resources:
    1
    a few questions for you, Rvsoldier...first of all why don't you have (Owner of (Casting unit)) Equal to Player 1 (Red) in those Any conditions?
    secondly...oh before i get to the second part why are you turning off the trigger before you have done any other actions? anyway, secondly why don't you just use all enemies of player (triggering player/owner of triggering unit/etc) ? i think that would work, be simple, and leakless. thirdly...oh screw it i forgot what the third question was.

    does that mean that ground units that don't raise and don't decay are removed also? or were you only referring to flying units?
     
  13. Rvsoldier

    Rvsoldier

    Joined:
    Oct 18, 2007
    Messages:
    141
    Resources:
    0
    Resources:
    0
    1. Then only player one would be able to use it. Using owner of casting unit any color can do it.

    1.5. That very first trigger just sets up the targets for the third so it doesn't have to redo it every time the spell is cast. You can shut off the trigger early on in it and the other actions will work, and it prevents it from running twice when it's only meant to run once.

    2. Pretty sure enemies don't include neutrals, doing that would screw up the targeting.
     
  14. SanKakU

    SanKakU

    Joined:
    May 11, 2008
    Messages:
    1,183
    Resources:
    1
    Maps:
    1
    Resources:
    1
    what are you talking about? i'm saying that player one CANNOT use it because you didn't add that to the list. you said you don't want only player one to be able to use it, i didn't say change the conditions, i said put that condition in there, in other words add it.

    unless you are leaving out some of the trigger that very first trigger does absolutely nothing because all it does is turn itself off. i guess you must be turning it on or running it with another trigger but i'm not sure how it's going to do anything when it turns itself off.

    and neutral hostile is an enemy. you might check with someone else but i think those are included in the all enemies of player 1. i know all allies of player 1 works great because it doesn't select players that aren't users or computers so i haven't tried doing enemies of player 1 to make it include neutral hostile so maybe it doesn't but if i had to guess if it did, i would say it does.

    edit: ok i read over your post again and it seems you're telling me that it doesn't matter where you put the actions, but i find that unlikely. at the least you are telling me that the action turn off this trigger doesn't occur until the trigger is done. i find that hard to believe.
     
  15. Rvsoldier

    Rvsoldier

    Joined:
    Oct 18, 2007
    Messages:
    141
    Resources:
    0
    Resources:
    0
    It shuts off the trigger immediately, just because it's shut off though, doesn't mean it won't complete the rest of its actions. Try putting the shutoff action at the beginning of a trigger that spawns a unit in the center of the map, it'll still work, but only once. I put turn offs like that at the very start of a trigger, to ensure it won't run twice under any circumstance.

    Player 1 and 7 (Red/Green) are computers, so they don't need to be included. Now I understand what you mean, sorry I left that out.

    That aside, any idea why it would leak?
     
  16. SanKakU

    SanKakU

    Joined:
    May 11, 2008
    Messages:
    1,183
    Resources:
    1
    Maps:
    1
    Resources:
    1
    oh yeah...the third question...what are you using that StarlightPlayerGroup for?
    ah, nevermind i see it...
    ok i take it the trigger is tested and works and you are looking for leakage?
    cuz i'm still trying to figure out if it works lol...
    the part where you are matching the units with owner of matching unit...does that work? hmm...

    anyway, confusion aside...i'm pretty sure that your remove location and remove unit from group actions shouldn't be in the if then action AND after that. i think you need to take those out of there.
    i say this because you're going to get to those actions after the if then action so you don't need them in the if then action and i think that doing it twice is a problem.

    sorry i can't be of any more help than this...i'm more of a learner than a teacher when it comes to programming, heh.
     
  17. Rvsoldier

    Rvsoldier

    Joined:
    Oct 18, 2007
    Messages:
    141
    Resources:
    0
    Resources:
    0
    No problem, at least you tried and didn't flame or anything, I appreciate that.

    And yes, the spell works. My solution to stats based line damage that hits multiple times xD. As for the remove action being there twice, yes I believe you're right about that. I'll try it.
     
  18. klemen

    klemen

    Joined:
    Sep 24, 2007
    Messages:
    301
    Resources:
    0
    Resources:
    0
    • Unit - Change ownership of Airfield 0078 <gen> to (Owner of (TRiggering unit)) and Change color


    What to do in this case? Storing a player (SomePlayer=Owner of triggering unit)->Action: ...to SomePlayer, or storing unit (SomeUnit=triggering unit-> action: ...to (Owner of SomeUnit)) or none?
     
  19. darkrider

    darkrider

    Joined:
    Dec 31, 2007
    Messages:
    780
    Resources:
    1
    Maps:
    1
    Resources:
    1
    actually... there is no leak in there
     
  20. klemen

    klemen

    Joined:
    Sep 24, 2007
    Messages:
    301
    Resources:
    0
    Resources:
    0
    ok, if those actions below have no leaks, I got the leak problem, other way not yet. :)

    • Then - Actions
      • Set SelectionLoc[(Player number of (Owner of (Attacked unit)))] = (Position of (Attacked unit))
      • Special Effect - Create a special effect at ShootingLoc[(Player number of (Owner of (Attacked unit)))] using Environment\LargeBuildingFire\LargeBuildingFire1.mdl
      • Special Effect - Destroy (Last created special effect)
      • Custom script: call RemoveLocation(udg_ShootingLoc[(Player number of (Owner of (Attacked unit)))])



    edit: leak checker reports me a leak here, what shall I do?

    • Else - Actions
      • Set BankGroup = (Player group((Owner of (Casting unit))))
      • Game - Display to BankGroup for 3.00 seconds the text: You don't have enou...
      • Custom script: call DestroyForce(udg_BankGroup)
     
    Last edited: Feb 9, 2009