- Joined
- Jan 11, 2009
- Messages
- 3,414
Hi.
I've found myself in need of detecting when a specific unit type takes damage, and what kind of unit is damaging it.
In my understanding, there is two ways of preforming this:
1. Create a single generic trigger and add the in events of the type "unit xxx takes damage". This method leaks an event once the unit dies.
2. Create a new trigger for each unit using the above event, and destroy it once the unit dies. If the trigger is removed while in use, this might cause corruption in the trigger stack.
As far as i know, there are two systems that does exactly what i want, those are the following:
Light Leakless Damage Detect
DamageEvent
Problem is, the last one does not compile since it uses optional library requirements, which somehow won't compile properly. I don't know why.
i can't remove the requirements, since the code is full of references to theese optional libraries, and i don't fully understand what everything does.
The second one has the problem that it seem to include ALL units on the map
(i did notice this text snippet:
Though there was no instructions of how to use it or what it does)
There is a total of about 10-12 unit types that i want to monitor, and all those systems just seem a bit too overkill for me.
Could someone either explain to me how i could use either of theese systems effectively, or how i could make something similar myself?
The ONLY thing i need to know is: when the unit is attacked (so that i can trigger a function), and who the attacker is, which i know.
Thanks in advance.
I've found myself in need of detecting when a specific unit type takes damage, and what kind of unit is damaging it.
In my understanding, there is two ways of preforming this:
1. Create a single generic trigger and add the in events of the type "unit xxx takes damage". This method leaks an event once the unit dies.
2. Create a new trigger for each unit using the above event, and destroy it once the unit dies. If the trigger is removed while in use, this might cause corruption in the trigger stack.
As far as i know, there are two systems that does exactly what i want, those are the following:
Light Leakless Damage Detect
DamageEvent
Problem is, the last one does not compile since it uses optional library requirements, which somehow won't compile properly. I don't know why.
i can't remove the requirements, since the code is full of references to theese optional libraries, and i don't fully understand what everything does.
The second one has the problem that it seem to include ALL units on the map
(i did notice this text snippet:
JASS:
private function AddEx takes nothing returns boolean
//! runtextmacro CGLeaklessDamageDetectAddFilter("GetFilterUnit()")
return false
endfunction
There is a total of about 10-12 unit types that i want to monitor, and all those systems just seem a bit too overkill for me.
Could someone either explain to me how i could use either of theese systems effectively, or how i could make something similar myself?
The ONLY thing i need to know is: when the unit is attacked (so that i can trigger a function), and who the attacker is, which i know.
Thanks in advance.