Thread: PowerupSentinel
View Single Post
Old 10-30-2009, 01:01 PM   #1
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,898

Submissions (37)

Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)

Hero Contest #3 - 2nd Place

Default PowerupSentinel

Err, ok, read the description comment.
Requires jasshelper 0.A.2.ish, better just get 0.A.2.6 or later.

If you paste it on newgen pack, use the //! zinc...endzinc stuff, when you paste it on a .zn file, remove the //! zinc and //! endzinc lines.

Err, ok, read the description comment.
Requires jasshelper 0.A.2.ish, better just get 0.A.2.6 or later.

If you paste it on newgen pack, use the //! zinc...endzinc stuff, when you paste it on a .zn file, remove the //! zinc and //! endzinc lines.

Updated to use some suggestions by Troll Brain.
Collapse Zinc:
//! zinc
/*
*  PowerupSentinel
*  ------------
*    Placing this library in your map will automatically fix all rune/tome
* memory leaks in your map.
*
*    Powerup items don't get removed automatically by the game, they instead
* just leave a small item in the map, this caused memory leaks but - worse -
* it also makes areas of your map where a lot of tomes have been used lag a lot.
*
*/
library PowerupSentinel
{
    function onInit(){
        trigger t = CreateTrigger();
        TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_DROP_ITEM);
        TriggerAddCondition(t, function()->boolean {
            if (GetWidgetLife(GetManipulatedItem())==0) {
                RemoveItem(GetManipulatedItem());
            }
            return false;
        });
    }
    
}
//! endzinc
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote
Sponsored Links - Login to hide this ad!