• 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.

Dodge basic attacks if not in range?

Status
Not open for further replies.
Level 3
Joined
Jul 22, 2017
Messages
30
In warcraft if the unit attacks and the oponnent moves away, the attack still hits once the animation is started. Is there a way to change this? Like if i move the enemy just miss the attack?
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
Yes, but you will need a Damage Detection System. When a unit takes attack damage from another unit, load that unit’s attack range value (from the ‘unit real field’ natives now in the game) and compare it to the distance between them. If larger then reduce the damage dealt to 0 and play a custom ‘miss’ floating text.
 
Level 3
Joined
Jul 22, 2017
Messages
30
Yes, but you will need a Damage Detection System. When a unit takes attack damage from another unit, load that unit’s attack range value (from the ‘unit real field’ natives now in the game) and compare it to the distance between them. If larger then reduce the damage dealt to 0 and play a custom ‘miss’ floating text.

Thanks, i tried and it worked. Is there any way to also nullify the sound?
 
Thanks, i tried and it worked. Is there any way to also nullify the sound?
No, short of setting all unit attack sound fields to nothing and then playing attack sounds manually yourself.
A tiny workaround for this is setting the armor type of the target to ethereal when a miss occurs. That way you will hear *kind of* a miss sound.
  • Sound
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
    • Conditions
    • Actions
      • Set DamageEventArmorT = ARMOR_TYPE_ETHEREAL
Playing attack sounds manually will probably sound very strange as I believe only one concurrent sound per channel can be played.
 
Status
Not open for further replies.
Top