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

[General] How to add/remove armor using triggers?

Status
Not open for further replies.
Level 30
Joined
Nov 29, 2012
Messages
6,637
Is there another way?

The only way is following Xonok's idea. To repeat it, to add armor, just add an abilty that adds armor such as Item Armor bonus or if you want an ability that increases armor of nearby units, Devoton Aura. For reducing armor, either remove ability that adds the armor, Item Armor bonus or Devotion Aura, whichever you used here or you can make an ability that adds a negative armor. Just configure again Devotion or Item Armor and set the armor given with a "-" sign
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
The poblem is that the game has items that have random +armor bonus. So when the item has +10 armor, the function is (IntegerA 1 to 10) with function add +1 armor :)
What? I'm not quite sure what you mean.
If you have a +10 armor bonus, then these will be added: +8 armor, +2 armor. There is no loop from 1 to 10 that adds +1 armor every time.
Did you try out the map? :p
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
How bonusmods work:

Lets say you want to add 4821 armor. It's a lot, but it's good to use large numbers in this example.
You have 13 abilities.
  • Slot 0 = +1
  • Slot 1 = +2
  • Slot 2 = +4
  • Slot 3 = +8
  • Slot 4 = +16
  • Slot 5 = +32
  • Slot 6 = +64
  • Slot 7 = +128
  • Slot 8 = +256
  • Slot 9 = +512
  • Slot 10 = +1024
  • Slot 11 = +2048
  • Slot 12 = +4096
If you look at the list of abilities you might notice, that the bonus of each ability is 2ˇSlotnumber(2 raised to power of Slotnumber)

You first check the highest amount in the list.
Is the amount higher or equal to 4096? Yes it is.
So you add 4096 armor and the amount that has to be added is decreased by 4096.
You now have 725 more armor to add.
Is the amount higher or equal to 2048? No
What about 1024? No
512? Yes
So you add 512 armor and decrease the amount that has to be added by 512.
You now have 213 armor to add.
Is it higher or equal to 256? No
128? Yes
So you add 128 armor.
You now have 85 armor to add.
Is the amount 64 or higher? Yes
Add 64 armor and you now have 21 to add.
Is the amount 32 or more? No
16 or more? Yes
Add 16 and you have 5 to add.
Is it 8 or more? No
4 or more? Yes, add 4 and you have 1 to add.
2 or more? No
1 or more? Yes. Add 1

Now the loop continues to check all other abilities or just ends.
The system has successfully added 4821 armor by using only 7 abilities.
With 13 abilities the system supports adding from 1 to 8191 armor. (highest amount*2)-1
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
Don't some of them do? I mean I know item abilities stack.

Item abilities don't, items do. If you put those abilities on units, then they no longer stack. And if you use up all 6 item slots, then you can have up to 2ˇ6 armor, which is only 64, while a bonusmod(like the one I made) can support millions, without taking any items or showing any abilities.

EDIT: Check BonusModHash in this map.
The bad side is that it's vJASS, so you can only use it with JNGPE. However, adding/removing stats is just 1 function, so it should be easy.
 

Attachments

  • Map Template v0.01t.w3x
    57.4 KB · Views: 45
Status
Not open for further replies.
Top