• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Is anyone able to write a custom script(for GUI) to detect type of an attack?

Status
Not open for further replies.
Level 5
Joined
Jan 3, 2008
Messages
164
Hello guys. I have searched everywhere in GUI but I cannot find any way to detect what type of an attack is is being carried out on a unit, can someone please write like 'Custom Script = ' in order to do that?
 
Level 5
Joined
Jan 3, 2008
Messages
164
I really think that it wouldn't work at all, and first of all you still didn't tell me how to detect the attack type. Because you want me to give a specific item to the attacker that would represent an attack type, but how will I know what one to give him if don't know his attack type??
 
Level 11
Joined
Dec 31, 2007
Messages
780
i had the same problem for a damage detection system i was using (made by me in gui... so it sucked xD) and i couldnt find an answer to that...

what bounty hunter said is that you can add an specific item to the unit that represents the attack type (but it will only work for damage made via normal attack not triggers neither spells) i would suggest a nicer way... instead of an item you can use a dummy armor ability with no armor bonus based on item armor bonus+1... change the name to the attack type of your hero and detect if the attacker has that type of ability... but what i understood that you wanted... i dont think it is possible :/
 
Level 5
Joined
Jan 3, 2008
Messages
164
Well, what I had in my mind is to use the advantages of different types of armor and the different types of attack, because they do different damage to different armor right? So, I was thinking to first detect the amount of damage the unit has received, and then (only for specific units which armor type you know), then test that amount of damage on different hidden units and see how much damage they will receive from it.. But its pretty confusing..
you can use this table:
Light Medium Heavy Fort Hero Unarmored
Normal 100% 150% 100% 70% 100% 100%
Pierce 200% 75% 100% 35% 50% 150%
Siege 100% 50% 100% 150% 50% 150%
Magic 125% 75% 200% 35% 50% 100%
Chaos 100% 100% 100% 100% 100% 100%
Spells 100% 100% 100% 100% 70% 100%
Hero 100% 100% 100% 50% 100% 100%
 
Level 6
Joined
Jun 14, 2008
Messages
191
Its impossible to detect damage though GUI (I'm not familiar with Jass) but once you get that the item thing should work (or dummy ability). You'd have to use an array for damage and set it for each unit.

Actually...If damage doesn't range, you could do is set say a unit's point value equal to their damage and use that to determine the damage they do. Then make the +armor an ability (you'd give this ability to your unit when its created and set the level accordingly).

Then to set the armor type / attack type, use the dummy ability or item or w/e u want.

So wait, ur doing all this to see how much damage a a hidden unit will take with dif armor types??? Hmm, I suppose you'd have to to deal damage to a hidden unit.

As you can see, it would be fairly complicated, I Just hope its worth it.



Edit: Btw, unless your units have constantly changing armor types, you can just do "if attacked unit type = (say footman), set 'armor_type' = 'Heavy' and set 'attack_type' = 'Normal'

if 'armor_type' of attacked unit = 'normal' and 'attack_type' of attacking unit = 'heavy'
then set HP of attacked unit = HP of attacked unit - 'point value of attacking unit' * '0.80'

So if the footman(normal, heavy, 10dmg) attacks say a knight(normal, heavy, 200hp),
it'll set the knights hp to 200-10*0.80) = 192.
 
Status
Not open for further replies.
Top