• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Goddess Bow (Block and counter attack spell)

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
Version 1.0 description:

The caster has a chance to block damage from an attack and instantly attack the attacker. The instant attack only works if the caster's auto attack is not on cooldown and the attacker is within the caster's attack range however. Also some orb effects don't apply to the counter attack (lifesteal, feedback, and slow posion are the only ones I confirmed to work). See https://web.archive.org/web/20160221164620/http://www.playdota.com/mechanics/Orb_Effects under the "Searing Arrows" manual-cast row of the table for ranged units for more info. The counter attack will cost mana based on the Searing Arrows ability's mana cost.

See triggers for import instructions.

Updates in version 1.1:
-Removed manacost from the counter attack (it can be re-enabled by editing the manacost of Searing Arrows Custom).
-Max counter attack range is now the max range of the searing arrows abililty, even if the caster's attack range is [normally] shorter.

Updates in version 1.2:
-Imported the correct version of damage engine
-Improved block trigger
-Extended configuration


Credits:
Damage Engine: Bribe
Searing Arrows instant attack trick: https://www.hiveworkshop.com/threads/snippet-making-a-unit-attack-instantly.274838/
Optional bow model: https://www.hiveworkshop.com/threads/thoridal-the-stars-fury-by-chilla_killa.150334/

Named after: https://yugioh.fandom.com/wiki/Goddess_Bow_(anime)

Key words: Counter Attack Evade and Counter Block
Contents

Goddess Bow (Map)

Reviews
Wrda
You can use this function to set unit's attack range instead of the upgrade. function SetUnitAttackRange takes unit u, real range, integer index returns nothing BlzSetUnitWeaponRealField(u, UNIT_WEAPON_RF_ATTACK_RANGE, index + 1, range -...
 
Thanks, this is what I was looking for
 

Wrda

Spell Reviewer
Level 25
Joined
Nov 18, 2012
Messages
1,864
You can use this function to set unit's attack range instead of the upgrade.
JASS:
    function SetUnitAttackRange takes unit u, real range, integer index returns nothing
        BlzSetUnitWeaponRealField(u, UNIT_WEAPON_RF_ATTACK_RANGE, index + 1, range - BlzGetUnitWeaponRealField(u, UNIT_WEAPON_RF_ATTACK_RANGE, index))
    endfunction

  • Conditions
    • (DamageEventTarget has buff GB_BUFF) Equal to True
    • IsDamageAttack Equal to True
    • (Random integer number between 1 and 3) Greater than or equal to (Level of GB_TOGGLE_ABILITY for DamageEventTarget)
I'm not sure what the third condition is doing here exactly in On Damage Goddess Bow trigger, since the ability has only one level at the moment.

The idea is interesting, but on the practical side it can be annoying if a player wants to run away while shielded, having to spam right click orders for the unit actually to move.

Approved
 
You can use this function to set unit's attack range instead of the upgrade.
JASS:
    function SetUnitAttackRange takes unit u, real range, integer index returns nothing
        BlzSetUnitWeaponRealField(u, UNIT_WEAPON_RF_ATTACK_RANGE, index + 1, range - BlzGetUnitWeaponRealField(u, UNIT_WEAPON_RF_ATTACK_RANGE, index))
    endfunction

I just tried that and the range gets set to nonsensical values instead of the desired value
 
Ah, my bad. Remove the "+ 1" part, then it should work.
Still not working
Code:
    function SetUnitAttackRange takes unit u, real range, integer index returns nothing
        call BlzSetUnitWeaponRealField(u, UNIT_WEAPON_RF_ATTACK_RANGE, index, range - BlzGetUnitWeaponRealField(u, UNIT_WEAPON_RF_ATTACK_RANGE, index))
    endfunction
 
Top