# Set max hp trigger based?

Status
Not open for further replies.

#### Isdariel

Level 2
Hello and thanks for the time you need to read and answer my question.
I'll describe first what I want to do in general, because probably you know an easier way to do it. Its a TD, and right now two factors contribute to the max. hp an incoming creep has: level and difficulty. The max. hp of a unit are set in the units propertys to the max. hp needed for the hardest difficulty, and then get reduced via trigger for lower difficuties. Of cause, this way you see creeps starting with e.g. 50% life all the time, but thats "just" something cosmetic and not my real problem. My real problem is: I want to add a third factor. Currently I do some math at first to figure out the creeps max. hp (which gets reduced by difficulty later, you know). But I know beforehand what kind of armor or special ability (both affect the max. hp) the creep will have, because actually those are determined by level. Now I want to change that and let creeps have e.g. random armor. Long story short: I need a way to calculate the max. hp in-game, because I am not really intrested in creating ~20 simliar looking creeps with different max. hp per level, just to pick one afterwards. :/
Of cause, there is a function like this:
Unit - Set life of (Last created unit) to ((Life of (Last created unit)) x Var)
And while it works great on reducing the actual hp, you cant modify the max. hp nor can you increase the actual hp over the max. hp.

For those who are intrested, I want to do it for >this< map. (Sorry if linking to (own) maps isnt allowed here, but I haven't found a rule against this)

Isdariel

#### RED BARON

Level 35
Dont understand that...

You mean you want a way to find the max hp a creep can get in your map? So that you can reduce the life of all the lesser lvls to something below that....

If it is so I dont understand why you need a trigger for it, plz post a very short explanation of what your problem is, what is the purpose...

#### Diablo-dk

Level 10
I think he means that he want's a trigger that changes the maximum hp of a unit.

WE doesn't have the option to change max hp, but a guy named Blade.dk made a function that does.
Go to the resource section on wc3campaigns and look for SetUnitMaxState.

If you don't know anything about using jass functions then there's not really any other solution.. Unless the problem isn't changing the max hp ofc..

#### Kixer

Level 9
I take it you want a function that changes a units max Hp?
There is a little JASS ( custom script ) function that does just that.
I don't have a direct link for you but if you just pop in at Wc3campaigns.net and look in the systems section, you should find a system by Blade.dk that does what your asking for...
- Hope this helps...

#### Isdariel

Level 2
Thanks both of you, I'll try that.

Edited: Solved that indeed. Thank you again.

Last edited:

#### Kixer

Level 9
LoL you read my mind Diablo, just couldn't remember the name of the function...

#### Diablo-dk

Level 10
(off topic)
what the? lol same posting time^_^

#### Razorbrain

Level 12
doesnt WEU have a "GUI" trigger for that?

#### PurplePoot

Level 40
WeU should not be touched, except perhaps for its tileset limit extension. It adds all sorts of stuff to your map, most of which you'll never use, and isn't that great either way.

#### Kixer

Level 9
It also gives problems with the new version of Warcraft...
But yes it did have such a "GUI" trigger action...

Status
Not open for further replies.

Replies
5
Views
1K
Replies
4
Views
1K
Replies
11
Views
1K
Replies
3
Views
639
Replies
14
Views
2K