• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Some question about damage detection

Status
Not open for further replies.
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:
JASS:
    private function AddEx takes nothing returns boolean
        //! runtextmacro CGLeaklessDamageDetectAddFilter("GetFilterUnit()")
        return false
    endfunction
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.
 
Status
Not open for further replies.
Top