How to increase/decrease stats by percentage of the hero?

Status
Not open for further replies.
Level 18
Joined
Jun 2, 2009
Messages
1,233
Hello everyone. I have an item that increases stats by 10% but i want to make it like this
When you pick item, it will increase your stats by 10% (include bonuses)
It is the easy part. I am making this trigger runs when the hero acquires any of the items or increases level and it matches the updated stat bonuses.
Difficult part is taking back the 10% and i am totally confused in here.
How to do that properly?

Example: Let us make it 50%. Your hero has 20 strength and this item increases strength by 20 and by 50%
It will become like this 20+0 > 30 (because it increased 20 to 30) +20
When you drop this, it should revert it like this. 30+20 > 20+0
 
Last edited:
Assuming you can only have 1 item of that type per hero, it's super easy to store the added value to a hashtable or unit-indexed-array and when adding, set the stored value, when removing, remove what the stored value say.

But New Bonus [vJASS][LUA] is super useful and I'd recommend anyone who want slightly more complex bonuses.
 
Status
Not open for further replies.
Top