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. We have recently started the 16th edition of the Mini Mapping Contest. The theme is mini RPG. Do check it out and have fun.
    Dismiss Notice
  4. Dismiss Notice
  5. The Highway to Hell has been laid open. Come along and participate in the 5th Special Effect Contest.
    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.

Do Powerups generally leak ?

Discussion in 'World Editor Help Zone' started by Thanathos, Aug 24, 2011.

  1. Thanathos

    Thanathos

    Joined:
    Aug 2, 2008
    Messages:
    202
    Resources:
    5
    Spells:
    5
    Resources:
    5
    Hi

    i was doing a spell request when i stumbled upon this. When a unit picks up a powerup (tomes, runes, lumber, etc.) it seems that the powerup is not completely removed from the game. Instead it turns invisible, although
    IsItemVisible()
    still returns true and those pseudo invisible powerups can still be detected by
    EnumItemsInRec()
    .

    Or do items have a decay time like units ? That would be weird since there is no decay time field for items in the object editor.

    However i created this tiny map which allows you to scan for "pseudo invisible" powerups.
     

    Attached Files:

  2. Garfield1337

    Garfield1337

    Joined:
    Jul 6, 2009
    Messages:
    1,806
    Resources:
    4
    Maps:
    1
    Spells:
    3
    Resources:
    4
  3. Maker

    Maker

    Joined:
    Mar 6, 2006
    Messages:
    9,181
    Resources:
    17
    Maps:
    2
    Spells:
    14
    Tutorials:
    1
    Resources:
    17
    If you inspect carefully, you'll see that used tomes do not turn invisible, they just shrink.
     
  4. Bannar

    Bannar

    Joined:
    Mar 19, 2008
    Messages:
    3,087
    Resources:
    20
    Spells:
    5
    Tutorials:
    1
    JASS:
    14
    Resources:
    20
    Unfortunately items don't 'decay' thus each tome, isn't removed after being used the small is created - item stays in game till end ;/ If enough tomes were bought/picked it can cause your game lag heavly.

    Use Bribe's system (linked by Garfield) for doing the tome-removing stuff for you (it allows item to play death animation) or simply create small script that reacts on
    Events: Unit - Uses an Item/Sells item
    Conditions: Item type equal to <tome>
    Actions: RemoveItem.

    ~Although the death animation won't be played.
     
  5. Bribe

    Bribe

    Joined:
    Sep 26, 2009
    Messages:
    8,120
    Resources:
    25
    Maps:
    3
    Spells:
    10
    Tutorials:
    3
    JASS:
    9
    Resources:
    25
  6. WaterKnight

    WaterKnight

    Joined:
    Aug 18, 2009
    Messages:
    4,033
    Resources:
    5
    Maps:
    1
    Tutorials:
    4
    Resources:
    5
    They are just killed.
     
  7. Bribe

    Bribe

    Joined:
    Sep 26, 2009
    Messages:
    8,120
    Resources:
    25
    Maps:
    3
    Spells:
    10
    Tutorials:
    3
    JASS:
    9
    Resources:
    25
    WaterKnight, do you know if items that are killed by attacking
    will also suffer the same issues? I can test this out on my own
    (not right now obviously, otherwise I wouldn't burden you by
    asking), but you seem to know a lot about items.
     
  8. Bannar

    Bannar

    Joined:
    Mar 19, 2008
    Messages:
    3,087
    Resources:
    20
    Spells:
    5
    Tutorials:
    1
    JASS:
    14
    Resources:
    20
    Ofcourse. Meaby I don't know that much as WaterKnight does, but it's just 'item-killing', the item still remains.

    EDIT: Bribe, are you thinking about updating your Item Clean up? ^^
     
  9. Bribe

    Bribe

    Joined:
    Sep 26, 2009
    Messages:
    8,120
    Resources:
    25
    Maps:
    3
    Spells:
    10
    Tutorials:
    3
    JASS:
    9
    Resources:
    25
    The next change would be to check if the item's life is less than
    0.401 instead of what I currently have for 0.405, based on Water-
    Knight's mention that items die at a different HP from units.

    Setting an item's life after it's already dead can be a very rare
    thing but it's obviously possible, and that would break ItemCleanup
    (user's fault, but whatever). I am thinking about making two
    versions of the system to solve this issue - the first one is the one
    I have now with the fix I have above, the second is to have a unit
    issue a "pickup item" order and if the order returns false the item
    is dead. I'm not sure, however, if there are some cases where the
    pickup order would return true for dead items or vice versa.
     
  10. WaterKnight

    WaterKnight

    Joined:
    Aug 18, 2009
    Messages:
    4,033
    Resources:
    5
    Maps:
    1
    Tutorials:
    4
    Resources:
    5
    Yes, they also remain when killed by attack. There was a thread recently about an item not vanishing after having played the death animation. It was noticeable because the model was changed to that of a unit.

    Destructables also use the 0.401 hp limit. The fun thing is that you can revive items by restoring the life and then reuse them.
     
  11. Bribe

    Bribe

    Joined:
    Sep 26, 2009
    Messages:
    8,120
    Resources:
    25
    Maps:
    3
    Spells:
    10
    Tutorials:
    3
    JASS:
    9
    Resources:
    25
    Alright, I'll run some tests when I'm home to make sure I get this
    right. That would explain why setting an item's life to 1 is necessary
    before removing it, because removing a dead item doesn't fully
    clear the leak but removing a living item removes it entirely.
     
  12. Thanathos

    Thanathos

    Joined:
    Aug 2, 2008
    Messages:
    202
    Resources:
    5
    Spells:
    5
    Resources:
    5
    I guess this thread served its purpose.
    Thanks and rep+ to everyone for your help.
    A mod might close this.
     
  13. busterkomo

    busterkomo

    Joined:
    Jun 17, 2007
    Messages:
    1,423
    Resources:
    1
    Tutorials:
    1
    Resources:
    1
    You're a fool then. Just use 0.
     
  14. Bribe

    Bribe

    Joined:
    Sep 26, 2009
    Messages:
    8,120
    Resources:
    25
    Maps:
    3
    Spells:
    10
    Tutorials:
    3
    JASS:
    9
    Resources:
    25
    A used tome will have life == 0 if its life wasn't set after its death,
    however a killed item might very well have 0.401.

    I fail to see how the thing you quoted me for merits calling me a fool,
    perhaps you can elaborate better than just calling me names.
     
  15. busterkomo

    busterkomo

    Joined:
    Jun 17, 2007
    Messages:
    1,423
    Resources:
    1
    Tutorials:
    1
    Resources:
    1
    Find an instance (with proof) where GetWidgetLife() on an item can return anything > 0 and < .401.
     
  16. Bribe

    Bribe

    Joined:
    Sep 26, 2009
    Messages:
    8,120
    Resources:
    25
    Maps:
    3
    Spells:
    10
    Tutorials:
    3
    JASS:
    9
    Resources:
    25
    Do it yourself.
     
  17. WaterKnight

    WaterKnight

    Joined:
    Aug 18, 2009
    Messages:
    4,033
    Resources:
    5
    Maps:
    1
    Tutorials:
    4
    Resources:
    5
    It gets set to zero either way, just like units. Since units cannot be revived by resetting the hitpoints, it is a bit pointless for them to compare against 0.405, they will keep resting even with a greater value.
     
  18. Bribe

    Bribe

    Joined:
    Sep 26, 2009
    Messages:
    8,120
    Resources:
    25
    Maps:
    3
    Spells:
    10
    Tutorials:
    3
    JASS:
    9
    Resources:
    25
    OK I have checked this out yesterday and can confirm it is useless
    to compare against 0.405 because the item's life is set to 0.00 no
    matter what it was set to before. The item's life set to anything less
    than 0 after death defaults to 0, but it retains whatever value you
    set it to if it's above 0 and below 1 (after 1 the item is restored for
    repeated use). So I've changed the checks in Item Cleanup to be
    equal to 0, it's the most sensible thing.