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

Use Ability Roar but add armor to % ?

Level 45
Joined
Feb 27, 2007
Messages
5,578
Honestly might be an integer level field; I don’t know how that appears in the OE but it wouldn’t surprise me.

Duck’s suggested solution can apply 25% of the caster’s armor to all targets. If you want to buff each affected unit to increase their armor by 25% of their own armor, this will not work for you. Instead you would need to use a custom Inner Fire ability and dummy-cast it onto all targets manually. You will set the armor granted by the ability via a trigger action in the same way as Duck suggested, but you’ll have to update this number before every cast (to grant the correct armor to each unit).
 
Level 3
Joined
Sep 6, 2016
Messages
6
  • Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set VariableSet Hashtable = (Last created hashtable)
      • -------- 1 - bonus armor from roar --------
  • Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Roar
    • Actions
      • Unit Group - Pick every unit in (Units within 500.00 of (Position of (Triggering unit)) matching ((((((Matching unit) is A structure) Not equal to True) and (((Matching unit) has buff Roar) Not equal to True)) and (((Matching unit) is Magic Immune) Not equal to True)) and ((((Owner of and do (Actions)
        • Loop - Actions
          • Set VariableSet Unit = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit is in RoarGroup.) Not equal to True
            • Then - Actions
              • Set VariableSet BonusArmorValue = (0.25 x (Armor of Unit))
              • Unit - Set Armor of Unit to ((Armor of Unit) + BonusArmorValue)
              • Hashtable - Save BonusArmorValue as 1 of (Key (Picked unit).) in Hashtable.
              • Unit Group - Add Unit to RoarGroup
            • Else - Actions
  • Check buff
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in RoarGroup and do (Actions)
        • Loop - Actions
          • Set VariableSet Unit = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit has buff Roar) Not equal to True
            • Then - Actions
              • Unit - Set Armor of Unit to ((Armor of Unit) - (Load 1 of (Key (Picked unit).) from Hashtable.))
              • Unit Group - Remove Unit from RoarGroup.
            • Else - Actions
 

Attachments

  • Bonus armor spell.w3m
    18.9 KB · Views: 5
Last edited:

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,877
I would adjust your triggers slightly to make it function like a standard Warcraft 3 spell.

You should recalculate, increase, and save the Armor regardless of whether they're in RoarGroup. But if they are already in the group you should first subtract the previous amount since you're going to increase it again.
  • Actions
    • Unit Group - Pick every unit in (Units within 500.00 of (Position of (Triggering unit)) matching ... and do (Actions)
      • Loop - Actions
        • Set VariableSet Unit = (Picked unit)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Unit is in RoarGroup.) Equal to True
          • Then - Actions
            • Unit - Set Armor of Unit to ((Armor of Unit) - (Load 1 of (Key (Picked unit).) from Hashtable.))
          • Else - Actions
        • Set VariableSet BonusArmorValue = (0.25 x (Armor of Unit))
        • Unit - Set Armor of Unit to ((Armor of Unit) + BonusArmorValue)
        • Hashtable - Save BonusArmorValue as 1 of (Key (Picked unit).) in Hashtable.
        • Unit Group - Add Unit to RoarGroup
Note that this leaks a unit group and a point.

For ideal precision, you would have a Dummy unit apply the buff to each unit in this group using something like Bloodlust rather than relying on the buff from Roar. This would allow you to check for the Buff rather than if the Unit is in RoarGroup which is much more efficient. It also means that you won't have any AoE issues since Abilities like Roar will take a unit's collision size into consideration when determining if units are in range where as the the Unit Group does not.

Also, this increases the unit's total Armor by 25% and not their base Armor. In other words, if your unit is affected by a +10 armor Devotion Aura at the time of casting, then it will gain an extra 2.5 armor (10 * 0.25 = 2.5). However, if it then walks out of the Devotion Aura range and loses the buff, it will lose the +10 armor but keep the extra 2.5 armor. If it had only applied to base armor then you would've never gotten the +2.5 armor in the first place.

As far as I know there is no native way to get the Base Armor. The two solutions I've seen are: 1) Use UI manipulation to read the unit's armor text, which is not very precise and needs syncing. 2) Design your map in a way so that you are tracking all sources of bonus Armor like with NewBonus.
 
Last edited:
Level 3
Joined
Sep 6, 2016
Messages
6
1. I saw there is a difference in spell range 500 and picking units in range 500 via trigger, in Roar's case there is no cast indicator, so problem is almost undetectable during casual playing. I agree, if the spell was selectable AoE it would be more suitable to use your method.
2. Dummies are good alternative to RoarGroup, but i don't see how to detect the moment, when unit's buff expires and substract bonus armor? I've tried one global picking unit trigger in my map and dozen of if/then/else checks for buffs, but it was causing lag every 1 second once the trigger was activated, so i created bunch of units' groups and picking triggers, each 0.01 sec after another and it's working smoothier now.
3. Definately should've used PointVariable = Position of UnitVariable, UnitGroupVariable and Array= Picked Unit and destroying them afterwards to prevent leaks
4. Using total armor is inaccurate, but it's the only simple idea. Ofc you can detect each possible armor changing buff/item/spell and substract it from total armor, but that's an overkill imo :D
 
Last edited:
Top