HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Checking if a unit had buff

02-10-2007, 02:25 PM#1
CommanderZ
Hello,
I need to check if the unit had a buff after its death (Unit Dies event)? It still tells me that the unit hasn't the buff
02-10-2007, 02:30 PM#2
Vexorian
You cannot do that.

The easiest way is to have an event when the units gets life less than 0.405, in that event you can check for buffs. Death units get their buffs removed.
02-10-2007, 03:52 PM#3
CommanderZ
Is it possible to register unit life event for all units globally (as generic unit event). I want to make somenthing like "When unit dies with buff XY on it the do ...".

A got this idea: Check every second all units whether they have the buff or not and for those who have it witie a value in gamecache. Is it viable?
02-10-2007, 07:42 PM#4
Av3n
Quote:
Originally Posted by CommanderZ
Is it possible to register unit life event for all units globally (as generic unit event). I want to make somenthing like "When unit dies with buff XY on it the do ...".

A got this idea: Check every second all units whether they have the buff or not and for those who have it witie a value in gamecache. Is it viable?

Just dop what Vex said it is the simplest way Well simpler than your way

-Av3n
02-10-2007, 08:05 PM#5
CommanderZ
I don't know which units have the buff, the only life event I have found is this:

Collapse JASS:
TriggerRegisterUnitStateEvent(trig, whichUnit, UNIT_STATE_LIFE, opcode, limitval)

Please, tell me if there is a generic life event, I haven't found it.
02-10-2007, 09:01 PM#6
Av3n
Its an condition... boolean look for buffs

-Av3n
02-10-2007, 09:34 PM#7
CommanderZ
Yes, i know that, but I need an EVENT to run that trigger. Generic->Unit dies does not work (as Vex said) and it seem generic->life event does not exist it exists only for a specific unit :(

Simply - I need to catch a moment just before death of a buffed unit or to do some sort of workaround...
02-10-2007, 10:09 PM#8
Pyrogasm
You could use global groups. Every X seconds of time, just set the group equal to units in the map that have the buff. Then, if a unit dies, check to see if it's in that group. If it is, then it died with the buff.

Also; GetWidgetLife() can return the life of any widget (Unit, destructable, building, and a couple other things I think). If a Widget's life is < 0.406, the widget is dead. That might help you if you don't want to go the way with global groups.
02-11-2007, 08:44 AM#9
CommanderZ
Sounds interesting! I will give it a try
02-11-2007, 11:09 AM#10
CommanderZ
It works, thank you

+ Rep :)
02-11-2007, 05:16 PM#11
Pyrogasm
No problemo. I'm assuming you're referring to me, correct?