In my map, to recycle units and prevent memory leak (event leak). I have a trigger like this:
in my map all locust are ancient.
to prevent a leak I did something like this:
when a unit in my map takes damage.
if (current HP) < (damage taken)
and (unit is not a hero)
then I make that damaged unit invulnerable, I hide it, and I add it to a unit group called DEAD_UNITS.
then I turn off the trigger that add units to event
I create a unit of the same type of the unit that was supposed to at and I kill this unit.
then I turn on again the trigger that add event to trigger
in future, instead of creating new units I unhide and make vulnerable a unit from DEAD_UNITS and then I move it to the place I want it to go.
I have just a few questions about my way to do it (my way is shit, I admit, But want to use it).:
1st: is it going to work?
2nd: can I prevent my leaks with 100% chance using it?
3nd: hidden units have colision?
This way allows me to detect buffs on "dead" (they are just hidden) units, and I think this is awesome.
Trigger:
- - Events:
- a unit enters playable map are
- - Conditions:
- triggering unit is an ancient equal to false
- - Actions:
- add event to damage detection (triggering unit) takes damage
in my map all locust are ancient.
to prevent a leak I did something like this:
when a unit in my map takes damage.
if (current HP) < (damage taken)
and (unit is not a hero)
then I make that damaged unit invulnerable, I hide it, and I add it to a unit group called DEAD_UNITS.
then I turn off the trigger that add units to event
I create a unit of the same type of the unit that was supposed to at and I kill this unit.
then I turn on again the trigger that add event to trigger
in future, instead of creating new units I unhide and make vulnerable a unit from DEAD_UNITS and then I move it to the place I want it to go.
I have just a few questions about my way to do it (my way is shit, I admit, But want to use it).:
1st: is it going to work?
2nd: can I prevent my leaks with 100% chance using it?
3nd: hidden units have colision?
This way allows me to detect buffs on "dead" (they are just hidden) units, and I think this is awesome.