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

Damage = Damage - armor

Level 13
Joined
Oct 28, 2019
Messages
523
Ive done a trigger, but Im having issues, when the armor is higher then the armor

  • Show Text 1
    • Events
      • Unit - A unit Takes damage
    • Conditions
      • (HeroVariable has buff Defend ) Equal to False
      • ((Damage taken) - (Armor of (Damage Target))) Greater than 1.00
    • Actions
      • Set VariableSet TempLoc1 = (Position of (Damage Target))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering player) is an ally of Player 2 (Blue).) Equal to True
        • Then - Actions
          • Game - Display to (All players) the text: run1
          • Event Response - Set Damage of Unit Damaged Event to ((Damage taken) - (Armor of (Damage Target)))
          • Floating Text - Create floating text that reads (<Empty String> + ((String((Integer((Damage taken))))) + <Empty String>)) at TempLoc1 with Z offset 100.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
          • Custom script: call RemoveLocation(udg_TempLoc1)
          • Floating Text - Change (Last created floating text): Disable permanence
          • Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
          • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
          • Floating Text - Set the velocity of (Last created floating text) to 80.00 towards 90.00 degrees
        • Else - Actions
          • Game - Display to (All players) the text: run2
          • Event Response - Set Damage of Unit Damaged Event to ((Damage taken) - (Armor of (Damage Target)))
          • Floating Text - Create floating text that reads (<Empty String> + ((String((Integer((Damage taken))))) + <Empty String>)) at TempLoc1 with Z offset 100.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
          • Custom script: call RemoveLocation(udg_TempLoc1)
          • Floating Text - Change (Last created floating text): Disable permanence
          • Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
          • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
          • Floating Text - Set the velocity of (Last created floating text) to 80.00 towards 90.00 degrees
Anyone can help me If the integer (damage - armor) is less then one the damage is always 1 ?
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,877
You answered your own question:
If the integer (damage - armor) is less then one
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • ((Damage taken) - Armor of (Damage Target)) Less than 1.00
the damage is always 1 ?
  • Then - Actions
    • Event Response - Set Damage of Unit Damaged Event to 1.00
The final product:
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • ((Damage taken) - Armor of (Damage Target)) Less than 1.00
    • Then - Actions
      • Event Response - Set Damage of Unit Damaged Event to 1.00
    • Else - Actions
Of course there's a cleaner way to do it like Nichilus suggested.
 
Top