Item Cleanup 1.3

Use
Every map that uses tomes should have this trigger. As many of us know, tomes never get removed after used, they stay as tiny little icons in the game, well, indefinitely. This trigger removes those nasty tomes. All you have to do is copy & paste this one trigger into your map and it works automatically.

This serves the exact same purpose as Tirlititi's Item Cleanup, but that library is in vJass. However, this is a very necessary thing to have in a map so I have made it available for GUI users.

  • Item Cleanup
    • Events
      • Time - Every 15.00 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ItemsToClean Greater than 0
        • Then - Actions
          • -------- Loop through all dead items and remove them --------
          • -------- This happens at the absolute soonest at 30 seconds of game time (if there were items to remove at the 15 second mark) --------
          • For each (Integer Loop) from 0 to (ItemsToClean - 1), do (Actions)
            • Loop - Actions
              • Item - Set life of CleanedItem[Loop] to 1.00
              • Item - Remove CleanedItem[Loop]
              • Set CleanedItem[Loop] = No item
          • Set ItemsToClean = 0
        • Else - Actions
      • -------- --------
      • -------- Pick up all dead items and flag them as ready to remove --------
      • -------- --------
      • Item - Pick every item in (Playable map area) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Current life of (Picked item)) Equal to 0.00
            • Then - Actions
              • Set CleanedItem[ItemsToClean] = (Picked item)
              • Set ItemsToClean = (ItemsToClean + 1)
            • Else - Actions
Credits
Vexorian (for PowerupSentinel)
Tirlititi (for Item Cleanup)

Keywords:
Trilititi, Vexorian, Item, Cleanup, Powerup, Sentinel, tome, leak
Contents

Item Cleanup Testmap (Map)

Reviews
Very useful for getting rid of used tomes for example.

Moderator

M

Moderator

Maker, 25th Aug 2011, Item Cleanup 1.2

Very useful for getting rid of used tomes for example.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
(Not even tested yet the map)

Does this map cleans up "leaked" tomes once per interval second ?

Then, what does this do ?

  • Removing Tomes Leak
    • Events
      • Unit - A unit Sells an item (from shop)
    • Conditions
      • *Any Tomes Type You Want*
    • Actions
      • Wait 0.00 seconds
      • Item - Remove (Sold Item)
It is simple, yet works perfectly (and it is MUI)
I don't know what does the trigger above is difference between the ones you made it.

Just curious.
 

Bribe

Code Moderator
Level 48
Joined
Sep 26, 2009
Messages
9,247
Not all tomes come from shops - many are already in the map or are dropped by creeps. You also can't use a "unit uses item" event because then it won't clean up items that were killed some other way.

Waiting 0.00 seconds will not allow the tome's death animation to be displayed. You'd have to wait 1.5 seconds to complete it, but then the wait might be innaccurate and be less than 1.5 seconds. So you have to use a game-time wait (PolledWait) which causes handle leaks and is generally an ugly thing to be avoided.

In summary, this is the most leakless and functional approach.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
So there is no difference in functionality, only difference in efficiency, just as I suspected :D
Thank you for clarifying this.

Also, you can pretty much add more Event than "A unit sells item..." Event, LOL
Acquires an item can work with "picking up tomes", is it ?
 

Bribe

Code Moderator
Level 48
Joined
Sep 26, 2009
Messages
9,247
There is a huge difference in functionality from what you said. Your script will cut off the item's death animation. If you change the wait to a game-time wait of 1.5 seconds you will then just create a leak for using that function at all.

There is no event "any item dies" either. This is the only way to do it properly.
 

Bribe

Code Moderator
Level 48
Joined
Sep 26, 2009
Messages
9,247
Ehh you have custom script in there, don't really understand it. Lol (Fail)

Why do you need to understand it? It's just a simple program.

If you have any concerns about something I can clarify it for you.

defskull said:
Wait, if Bribe is upload his own system who would certify his system to be approved or not ?
Maker ?

Him or The_Reborn_Devil. Moderaters can not moderate their own stuff thankfully.
 
Level 37
Joined
Aug 14, 2006
Messages
7,602
Okay back from testing. I improved the testing map of yours and tested a little. I made a trigger that checks every second how many items there are in the map. When I acquire or destroy an item the counter won't decrease.

So, does your system really work?

I'm probably gonna use this system but I want first your explanation.

Map is attached to this post.
 

Attachments

  • Item Cleanup testing.w3x
    15.5 KB · Views: 295

Bribe

Code Moderator
Level 48
Joined
Sep 26, 2009
Messages
9,247
Thank you for the testing - Tirlititi was right - you do need to set the item's life to 1
before removing, otherwise it can still be enumerated. What a glitch.

The demo map has been fixed now. I recommend anyone who uses this script to either
re-copy it or to manually change this:

  • Item - Remove CleanedItem[Loop]
  • Set CleanedItem[Loop] = No item
To this:

  • Item - Set life of CleanedItem[Loop] to 1.00
  • Item - Remove CleanedItem[Loop]
  • Set CleanedItem[Loop] = No item
 
Level 2
Joined
Aug 22, 2014
Messages
7
Hi guys i need 1 little help I need to clean up map from items every X sec if number of items or items of type on map are >= X how can I do it using trigger?
 

Bribe

Code Moderator
Level 48
Joined
Sep 26, 2009
Messages
9,247
I do not remember well if item groups leaked or not but I fear that they leak and are not removable.

Sorry I did not see this until now. In case you or someone else is reading this, there is no such thing as an "item group". Picking all items/destructables/playing doodad animations does not leak as there are no handles being created to perform those actions.
 

Bribe

Code Moderator
Level 48
Joined
Sep 26, 2009
Messages
9,247
Update to 1.3 - this is completely optional to update to. I shortened and simplified the code quite a bit, and made it use two fewer variables. It now runs on one timer, every 15 seconds, but instead of setting a 1.5-second timer to remove those items, it just queues them up so that on the next 15-second interval, the items are cleaned up at that point.

Functionally, and implementation-wise, it works exactly the same as it did before. Users of version 1.3 can delete the variables "ItemCleanupFlag" and "ItemCleanupTimer" from your map.
 
Level 5
Joined
Jul 4, 2007
Messages
84
This is great. I simplified it because hundreds of tomes get bought in my map each minute and the occasionally cut off animations don't matter as much to me.

  • Remove Tomes
    • Events
      • Time - Every 3.33 seconds of game time
    • Conditions
    • Actions
      • -------- Used tomes' leftover corpses litter the ground... --------
      • -------- (This used to not be necessary in older versions of Warcraft.) --------
      • -------- Typical Blizzard breaking stuff... Now we have to clean up after them. --------
      • Item - Pick every item in (Playable map area) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Current life of (Picked item)) Equal to 0.00
            • Then - Actions
              • Item - Set life of (Picked item) to 1.00
              • Item - Remove (Picked item)
 

Bribe

Code Moderator
Level 48
Joined
Sep 26, 2009
Messages
9,247
This is great. I simplified it because hundreds of tomes get bought in my map each minute and the occasionally cut off animations don't matter as much to me.

  • Remove Tomes
    • Events
      • Time - Every 3.33 seconds of game time
    • Conditions
    • Actions
      • -------- Used tomes' leftover corpses litter the ground... --------
      • -------- (This used to not be necessary in older versions of Warcraft.) --------
      • -------- Typical Blizzard breaking stuff... Now we have to clean up after them. --------
      • Item - Pick every item in (Playable map area) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Current life of (Picked item)) Equal to 0.00
            • Then - Actions
              • Item - Set life of (Picked item) to 1.00
              • Item - Remove (Picked item)

Yeah whatever works best for you. I would however still recommend allowing the animations to play, so in that regard I recommend using my library but only modifying the timer to a value no lower than 1.50 seconds.
 
Level 20
Joined
Feb 23, 2014
Messages
1,265
@Bribe I've recently started exploring some of your systems, dude, and I just want to say that I appreciate all the amazing work you did for this community! Stay awesome! :)

P.S. Obviously using this for my map experimentations :)
 

Bribe

Code Moderator
Level 48
Joined
Sep 26, 2009
Messages
9,247
thanks for posting this.

are pawned items considered dead?
Those don’t stick around. Tomes were intentionally patched around 15-20 years ago to stick around permanently so as to leave an “indicator” to people exploring cleared creep camps on ladder as to what kind of item the opponent might’ve grabbed (it is why there is a death animation that is played when the fog of war unveils it).
 

Bribe

Code Moderator
Level 48
Joined
Sep 26, 2009
Messages
9,247
Thanks for info. Also, could I increase the periodic time to lessen the amount of triggers running? There are only a few powerups in this map but figured why not add this system.
Sure, it’s fine to change the time in the event to any time you want. Every minute or two is probably fine, I think I mainly set it to be this frequent because I wanted to make sure that the demo didn’t keep people too long to see how it works.
 
Top