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.

Will this leak? Spawn at point.

Discussion in 'Triggers & Scripts' started by IronForge, Dec 12, 2010.

  1. IronForge

    IronForge

    Joined:
    Jun 7, 2008
    Messages:
    414
    Resources:
    1
    Maps:
    1
    Resources:
    1
    • Stealth 360
      • Events
        • Unit - A unit Begins casting an ability
      • Conditions
        • (Ability being cast) Equal to Stealth (Interceptor generic 360s dummy)
      • Actions
        • Unit - Create 1 Dummy Invisibility for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing Default building facing degrees
        • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
        • Unit - Order (Last created unit) to Human Sorceress - Invisibility (Triggering unit)


    It isn't a 'center of' trigger, so was wondering if it will still leak. This is for my battleships game.
     
  2. MultiGod

    MultiGod

    Joined:
    Jan 17, 2009
    Messages:
    721
    Resources:
    0
    Resources:
    0
    Yes, it will leak.

    It will always leak whenever you assign a handle without using a variable.
    Assign 'Position of Triggering Unit' to a variable then use the variable for the action.
    Then, clean the location with
    Custom Script: "call RemoveLocation(udg_variablename)"
     
  3. SanKakU

    SanKakU

    Joined:
    May 11, 2008
    Messages:
    1,183
    Resources:
    1
    Maps:
    1
    Resources:
    1
    you can use a different create unit function to spawn at coordinates instead. the reals used in a set of coordinates don't leak. there is a giant does this leak thread somewhere you could also check. there is also a function called GetUnitX(and GetUnitY) which is useful, even GetLocationX which help to get your coordinates. if you stick with that same old create unit function that you are using, you'll need to clean the reference as already mentioned.

    center of region makes the game register the point called the center of region. all you're doing here is making the game register the point called where the unit is at.

    when you're dealing with points, and they are significant, i prefer to use global variables. your trigger doesn't use variables at all. using global variables can be buggy if you try using them for insignificant situations such as this. in an insignificant situation like this, the game can easily produce some reals and use an alternate function. then throw the reals away. it's a little more difficult to throw away a point because the game assumes you will need the point again.
     
  4. mckill2009

    mckill2009

    Joined:
    Mar 10, 2009
    Messages:
    4,696
    Resources:
    34
    Maps:
    5
    Spells:
    27
    JASS:
    2
    Resources:
    34
    TIP: dont use this >>> Unit - A unit Begins casting an ability

    but use >>> Starts the effect on ability
     
  5. defskull

    defskull

    Joined:
    Mar 27, 2008
    Messages:
    7,978
    Resources:
    17
    Spells:
    17
    Resources:
    17
    Here's my full comment:

    • Unit - A unit Begins casting an ability

    Don't use this action, instead, use "Starts the effect of an ability"
    It may lead to abusive action such as, the trigger is fired, but no cooldown and mana cost to the casting unit, because the trigger is fired even before the spell is fired

    • Unit - Create 1 Dummy Invisibility for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing Default building facing degrees

    This LEAK, point-type leak
    You must save the point through variable first, only then, you can clean the leak
    Like this:
    • Actions
      • Set DummyLocation = (Position of (Triggering unit))
      • Unit - Create 1 Dummy Invisibility for (Owner of (Triggering unit)) at DummyLocation facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_DummyLocation)

    DummyLocation is Point-type variable
    To set a variable, go to Action and find Set Variable action
    This way, it is leakless

    • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)

    Usually, I use 0.50 for better efficiency
    Standard casting time for all unit is at most 0.2 ~ 0.3 second
    Using a 1 second clean leak of a unit creation dummy is not wrong, but you can shorten its lifespan, it is more efficient
     
  6. IronForge

    IronForge

    Joined:
    Jun 7, 2008
    Messages:
    414
    Resources:
    1
    Maps:
    1
    Resources:
    1
    • Stealth 360
      • Events
        • Unit - A unit Begins casting an ability
      • Conditions
        • (Ability being cast) Equal to Stealth (Interceptor generic 360s dummy)
      • Actions
        • Set temploc = (Position of (Triggering unit))
        • Unit - Create 1 Dummy Invisibility for (Owner of (Triggering unit)) at temploc facing Default building facing degrees
        • Unit - Add a 0.50 second Generic expiration timer to (Last created unit)
        • Unit - Order (Last created unit) to Human Sorceress - Invisibility (Triggering unit)
        • Custom script: call RemoveLocation(udg_temploc)


    Like this? There is no mana cost so it's fine, cooldown is almost nonexistent too.
     
  7. defskull

    defskull

    Joined:
    Mar 27, 2008
    Messages:
    7,978
    Resources:
    17
    Spells:
    17
    Resources:
    17
    Yes, PERFECT =p
     
  8. SanKakU

    SanKakU

    Joined:
    May 11, 2008
    Messages:
    1,183
    Resources:
    1
    Maps:
    1
    Resources:
    1
    this is not even close to true unless you have very limited spells.
    if you want the dummy to channel something, it will not work.
    if you want the dummy to have a delay(some casting time added to the spell), it will not work.
    if you want the dummy to cast a spell periodically, it will not work once the period times the casts passes the lifespan.
    there are probably other reasons why your suggestion is wrong, as well.

    in short, the dummy dying is not a leak cleaning...the game will do that on it's own. but you should kill the dummy unless he has automatic death configured into him(negative regen like phoenix, or something). all killing the dummy sooner accomplishes is makes one less unit on the screen, which is only desirable if you have a large number of units to deal with at any given time. in that case, the spell will still be broken if you try to do any of the above things and don't set the expiration timer for the dummy high enough.
     
  9. IronForge

    IronForge

    Joined:
    Jun 7, 2008
    Messages:
    414
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Ah k it's instant cast so shouldn't be a problem. However why not just have one dummy in the game with infinite cast range so he can affect any unit on the map? And he can juggle 5 custom skills at once! (not that I have that many)
     
  10. SanKakU

    SanKakU

    Joined:
    May 11, 2008
    Messages:
    1,183
    Resources:
    1
    Maps:
    1
    Resources:
    1
    there is a system that works like that. although, i don't like it...
    the reason being all damage from spells wold have to be done manually through the triggers in order to get the correct killer of a unit. because the dummy unit is owned by someone other than the player. at least, that's how that system worked.