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

[General] Adding Armor bonus to basic attack

Status
Not open for further replies.
Level 2
Joined
Aug 28, 2020
Messages
15
Is there anyway to create a trigger or skill that apply the bonus armor or the armor as a bonus to a hero's attack? Does someone already tried? (Something like, level 1 add 20% of the armor as attack bonus level 2 add 40% of the armor as attack bonus etc...)
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,563
Here's a very basic way of doing what you described, It's setup so that it will work for multiple units. If you will only have a single Hero with this ability then I recommend scrapping all of the Unit Group stuff and instead reference the Hero directly.

Setup the ability:
  • Learn Armor Ability
    • Events
      • Unit - A unit Learns a skill
    • Conditions
      • (Learned Hero Skill) Equal to Armor Ability (Learn)
      • (Learned skill level) Equal to 1
    • Actions
      • Unit Group - Add (Triggering unit) to ArmorGroup
      • Unit - Add Armor Ability (Damage) to (Triggering unit)
      • Trigger - Turn on Armor Ability <gen>
Update attack damage:
  • Armor Ability
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in ArmorGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is alive) Equal to True
            • Then - Actions
              • Set VariableSet Armor = (Armor of (Picked unit))
              • Set VariableSet Multiplier = (0.20 x (Real((Level of Armor Ability (Learn) for (Picked unit)))))
              • Set VariableSet Result = (Armor x Multiplier)
              • Ability - Set Ability: (Unit: (Picked unit)'s Ability with Ability Code: Armor Ability (Damage))'s Integer Level Field: Attack Bonus ('Iatt') of Level: 0 to (Integer(Result))
              • Unit - Increase level of Armor Ability (Damage) for (Picked unit)
              • Unit - Decrease level of Armor Ability (Damage) for (Picked unit)
            • Else - Actions
This uses the Item Damage Bonus ability to add the attack damage. The increase level/decrease level actions are weird but necessary as they "refresh" the ability causing it's stats to update immediately. Warcraft 3 is a mess :p
 

Attachments

  • Armor Ability.w3m
    18.4 KB · Views: 18
Last edited:
Status
Not open for further replies.
Top