HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Checking a unit's attack type

07-05-2009, 07:36 AM#1
cokemonkey11
Hi there, for my damage detection based knockback system, I'd like units with piercing damage to have a 50% multiplier on their kb power.

Right now I just do if then checking if the damage source is a unit type (xyz) and then set power=power/2

How can I make this more modular so instead of using 'or' a thousand times it just says something like GetUnitDamageType(source)==DAMAGETYPEPIERCING or something along those lines.

Thanks in advance.
07-05-2009, 08:15 AM#2
DioD
use hashtable

arrayattacktype[Hash8191(GetUnitTypeId(GetDamageSource()))]

Hash8191 == hash functions from any storage system based of ox100000 deduction

you shoud fill array self, since damage type detection ingame cannot be done in instant manner.
07-05-2009, 08:29 AM#3
cokemonkey11
That sounds annoying. I was hoping I was being retarded by not finding a native. I'll just use if thens for now. Thanks for the quick answer.
07-05-2009, 08:53 AM#4
Fledermaus
You could also give all units a dummy ability that represents attack type and just check that.
07-05-2009, 10:27 AM#5
DioD
hashtable is way, after next patch with native hash table this is only way.
07-05-2009, 12:07 PM#6
Blubb-Tec
Quote:
Originally Posted by DioD
hashtable is way, after next patch with native hash table this is only way.

Table is way. Or is there any reason for a system like a dd/knockback to not require Table?
07-05-2009, 12:18 PM#7
Hans_Maulwurf
I would give every unit with piercing damage a dummyspell without icon and effect (eg: AoE-Damage on death with targets set to none) and just check if the caster has this spell.