• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

How to change life of unit in game with triggers

Status
Not open for further replies.
Level 3
Joined
Sep 6, 2004
Messages
36
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.
 
Level 9
Joined
Aug 27, 2004
Messages
471
...

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.
 
Level 11
Joined
Jul 20, 2004
Messages
2,760
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
 
Level 7
Joined
May 16, 2004
Messages
355
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.
 
Status
Not open for further replies.
Top