• 🏆 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!

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 40
Joined
Feb 27, 2007
Messages
5,094
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