| 09-30-2007, 01:57 AM | #1 |
Heya, I'm look for a good way to detect how much damage an individual unit is doing reguardless of being ranged/melee. I'm trying to avoid detecting every unit in an event, but blizzard seems to only support unit's taking damage anyway -,-. Thanks for the help. |
| 09-30-2007, 07:58 AM | #3 |
Since this is about damage, might I also ask a question? With the native: JASS:native UnitDamageTarget takes unit whichUnit, widget target, real amount, boolean attack, boolean ranged, attacktype attackType, damagetype damageType, weapontype weaponType returns boolean what does boolean attack and boolean ranged do? What are the differences? Damage1: call UnitDamageTarget(u, t, 1, true, false, null, null, null) Damage2: call UnitDamageTarget(u, t, 1, true, true, null, null, null) Damage3: call UnitDamageTarget(u, t, 1, false, false, null, null, null) Damage4: call UnitDamageTarget(u, t, 1, false, true, null, null, null) Oh, and I'm also curious about passing attacktypes and damagetypes as null, what would happen then? |
| 09-30-2007, 12:54 PM | #4 |
boolean attack defines in how the hardcoded AI will make react the attacked unit. If it's set to true, the attacked unit will know who was the attacker and it will attack the damage source if it's in the attack range. If it's set to false, the attacked unit won't know who is attacking and it will move away, trying to "avoid more damage". About ranged boolean, I'm not sure, but I suggest to set it according to the situation. About the damage types, only set to null the weapon type, the others control the damage, but I think that setting them to null would be equivalent to dealt a chaos damage (honestly I haven't tested it). |
| 09-30-2007, 06:08 PM | #5 |
I forgot to mention, my method would give you an average for each unit-type that you could reference later in the game. It's not a method for getting it on-the-fly, nor will it be 100% accurate. |
| 09-30-2007, 11:45 PM | #6 |
I tried your function pyro, it wont work for my map, several units have the same damage, and hero's that level will change there damage. Even if I update it for heros, there's to big of a chance that several units will conflict in damage. I've made about four functions trying to test damage, none of them are very accurate and seem to return the wrong mob about 8-12% of the time. Still, that wont stop me. |
