• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Do Powerups generally leak ?

Status
Not open for further replies.
Level 9
Joined
Aug 2, 2008
Messages
219
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.
 

Attachments

  • power up leak test.w3x
    17.3 KB · Views: 45

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
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.
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
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.
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
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.

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.
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
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.
 
Status
Not open for further replies.
Top