• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Decreasing unit max HP

Status
Not open for further replies.
Level 3
Joined
Aug 19, 2005
Messages
47
Let's say I have an unit which starts with 1000 hp. How can I decrease its max HP to 900 on the run? JASS allowed.

TY
 
Level 3
Joined
Aug 19, 2005
Messages
47
That system is a bit overkill for me, I just want to drop the HP from 1000 to 900. I know it is something with adding and removing bonus HP ability, but I managed only to increse max HP, not to decrease it.
 
Level 8
Joined
Feb 20, 2007
Messages
338
Through triggering there are two functions:

  • Actions
    • Unit - Set life of (Triggering unit) to 100.00%
    • Unit - Set life of (Triggering unit) to 900.00
The first is percentages, the second is a value.

I have no idea what event and/or conditions you need to trigger the trigger.
 
Level 5
Joined
Jul 26, 2004
Messages
99
Here's a fairly simple way to do it using "upgrades".

Create a unit with 900 max hit points.
Give it an upgrade that increases it's max health by 100.
Automatically apply the upgrade at map startup (or whenever) so that it will have 1000. To lower it's health, simply reduce the level of the upgrade.

To only have a "specific unit" receive the effect, you could make the upgrade non-global (do this by inputing "true" for 'applies to all units' within the upgrade... don't ask me why it's backwards, it just is). This makes it so that the upgrade will only apply to units that are made after the upgrade takes effect. So, you could:

1. decrease the upgrade
2. replace the unit with the same type, facing same direction and keeping it's current hp/health etc.
3. re-increase the upgrade (to ready it for future occasions).

Hope all that made sense.
 
Status
Not open for further replies.
Top