• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

% of hp/mana based buff

Status
Not open for further replies.
Level 3
Joined
Oct 31, 2014
Messages
55
I want to make a passive that increase the unit attack damage equal to a % of his maximum health or mana. does anybody knows how to do it?
 
Last edited:
Thx :D, but i have a question, i want to make that a hero ability with 7 levels, can i set that with this? or you have to make a new code?
 
Thx :D, but i have a question, i want to make that a hero ability with 7 levels, can i set that with this? or you have to make a new code?

You didn't quite specified anything about what it was so I made a very basic one... Have seen a similar question coming up :D

The code that I sent to you is very dynamic.
All you have to change is this simple code:

JASS:
local integer level = GetUnitAbilityLevel(u, 'A004')
You have to add it next to the other local stuff and at least under the local unit u.
Then you remove the local percentage thingy and make a new one:
JASS:
local real percentage = 10 + 5*level
Put it at least under the local integer level

The 10 + 5 * level is a simple example of what you can do.
In this case the increased damage is this:
Level 1 = 10 + 5 = 15%
Level 2 = 10 + 5 + 5 = 20%
Level 3 = 10 + 5 + 5 + 5 = 25%
etc. etc. etc.

Optimalization:
You can replace the "if (GetUnitAbilityLevel(u, 'A004') == 0)" with "if (level == 0)" as those are the same thing.
 
i got some issues with the code, i got +1300 and +7400 more dmg o.O wayyy more than intended, can you post how the whole code has to look like? i believe i am doing something wrong :S.
whoops i was messing with the order of these abilites A000, A001, A002, A003, i believe i fixed it :P
 
Status
Not open for further replies.
Back
Top