Warcraft III resources & community, 2003–2006 · archived

How to change life of unit in game with triggers

4 posts
#1

How to change life of unit in game with triggers

I have this spell that when cast it summons a unit then then sets its max life to

(Max life of Unit + (5*(Intel of Hero summoning the Unit))

I know how to do everything but i can't seem to find how to change the max life of a unit. I just found how to change the current life. Please Help.
#2

...

Change life
Events
Unit - A unit Spawns a summoned unit
Conditions
Actions
Unit - Set life of (Summoned unit) to (Life of (Summoning unit))%
-------- or --------
Unit - Set life of (Summoned unit) to ((Max life of (Summoned unit)) + (5.00 + (Max life of (Summoning unit))))


Should work if this is what u wanted.
#3
Ok... The problem with maximum life is that you cannot manipulate it through triggers. And least, I don't know how. You could use an upgrade which manipulates the maximum life and then set its level to whatever you need. But it is very inefficient and I'd be surprised if someone would be able to find an easier solution for this problem. And no, I don't think WEU is a good solution since on some computers, it crashes.

So I don't suggest you stick into this area of modifying the maximum life. It's a very delicate area. However, I will ask Vexorian.

~Daelin
#4
Hmm, what you propose is a tricky little dealy. Like Daelin said with the traditional WE there is no way to affect the units maximum life. I know a way to give the illusion that it is a the correct life. You could set up a variable that is set once it is summoned, this would be the amount of life the summon is supposed to have. Then later when the unit takes damage make the damage be negated then figure out the percentage of the life its supposed to have that the amount of damage taken is. After this make it damage the unit that has, lets say 100000 life(so the life wont show on the bar) by the percentage that was calculated. This woulnd't be pretty but it would make the unit die at the correct time and the life bar would look correct. Good god that was a mouthful.