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

Agility as a dodging factor

Level 4
Joined
Oct 9, 2024
Messages
63
I want to create a trigger that allows agility to influence dodge as a factor. Since there's no existing field for dodge within the constants, I’ll need to set up a trigger. My initial idea is to add a passive dodge skill to all heroes and somehow make the icon hidden. Then, I would create a trigger to set the dodge rate of this skill equal to each hero's agility stat. However, I’m not sure about the best event to use—should it be a periodic event, or is there a better approach?
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,872
I want to create a trigger that allows agility to influence dodge as a factor. Since there's no existing field for dodge within the constants, I’ll need to set up a trigger. My initial idea is to add a passive dodge skill to all heroes and somehow make the icon hidden. Then, I would create a trigger to set the dodge rate of this skill equal to each hero's agility stat. However, I’m not sure about the best event to use—should it be a periodic event, or is there a better approach?
It sounds like you have the right idea.

Remember what we did with Holy Light and Intelligence? Do the very same thing but with the Evasion ability and Agility.
  • Hero Evasion Setup
    • Events
      • Unit - A unit Enters (Playable map area)
    • Conditions
      • (Triggering unit)) is a Hero) Equal to True
    • Actions
      • Set Variable EvasionUnit = (Triggering unit)
      • Set Variable EvasionAbility = My Evasion Ability (Hidden)
      • -------- --------
      • -------- Add and update the evasion ability --------
      • Unit - Add EvasionAbility to EvasionUnit
      • Custom script: call UnitMakeAbilityPermanent( udg_EvasionUnit, true, udg_EvasionAbility )
      • Trigger - Run Hero Evasion Update (ignoring conditions)
      • -------- --------
      • -------- Update their evasion periodically --------
      • Unit Group - Add EvasionUnit to EvasionGroup
      • Trigger - Turn on Hero Evasion Periodic
  • Hero Evasion Update
    • Events
    • Conditions
    • Actions
      • Set Variable EvasionAgility = (Real(Agility of EvasionUnit (Include bonuses)))
      • Set Variable EvasionAgility = (EvasionAgility x 0.01)
      • Ability - Set Ability: (Unit: EvasionUnit's Ability with Ability Code: EvasionAbility)'s Real Level Field: Chance to Evade ('Eev1') of Level: 0 to EvasionAgility
      • -------- --------
      • -------- This is a fix to a bug that prevents the field changes from applying. We call this "refreshing" the ability --------
      • Unit - Increase level of EvasionAgility for EvasionUnit
      • Unit - Decrease level of EvasionAgility for EvasionUnit
  • Hero Evasion Periodic
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in EvasionGroup and do (Actions)
        • Loop - Actions
          • Set Variable EvasionUnit = (Picked unit)
          • Trigger - Run Hero Evasion Update (ignoring conditions)
You can hide any ability by going into the Object Editor and setting it's Art - Button positions to X: 0, Y: -11.
1729867756588.png

Hold Shift when opening a field to allow negative values and bypass other limitations. You may need to enable this in File/Preferences.
 
Last edited:

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,872
I'm studying and trying to apply your explanation uncle, thank you very much.
The variable types I used:

EvasionUnit = Unit
EvasionAbility = Ability Code
EvasionGroup = Unit Group

So you need three variables, three triggers, and one custom Evasion ability.

Make the custom Evasion ability a non-Hero ability, set it's Levels to 1, set it's Chance to Evade to 0.00, and hide it using the method I described before.
 
Last edited:
Top