• 🏆 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!

Help to make Low health - more damage/armor trigger

Status
Not open for further replies.
Level 6
Joined
Aug 31, 2018
Messages
157
I really need to find a way to do that trigger.
For example: A unit life drops below 50% then he gain bonus armor/attack damage or damage reduction.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,542
If it's one unit then store it as a variable to keep track of it. If it's multiple units then add them to a Unit Group to keep track of all of them.

For one unit:

Events:
Every 0.10 seconds

Actions:
Set variable Health = The current percentage of your unit's life
If Health <= 50% and level of Armor Bonus not equal to 1 then do
Add ability Armor Bonus to your unit
Add ability Damage Bonus to your unit​
Else if Health >50% and level of Armor Bonus equal to 1 then do
Remove ability Armor Bonus from your unit
Remove ability Damage Bonus from your unit​
-------------------------------------------------------------------------
For multiple units:

Events:
Every 0.10 seconds

Actions:
Pick every unit in Health Unit Group and do
Set variable Health = The current percentage of picked unit's life
If Health <= 50% and level of Armor Bonus not equal to 1 then do
Add ability Armor Bonus to picked unit
Add ability Damage Bonus to picked unit​
Else if Health >50% and level of Armor Bonus equal to 1 then do
Remove ability Armor Bonus from picked unit
Remove ability Damage Bonus from picked unit​
--------------------------------------------------------------------------
Armor Bonus and Damage Bonus would be based on the Claws of Attack bonus damage and Ring of Protection bonus armor abilities. You could also use a Dummy Unit to cast Inner Fire on your unit to add Armor and Damage. Although, it would be dispellable since it's a buff.
 
Last edited:
Level 14
Joined
Nov 17, 2010
Messages
1,265
This would only work for one hero or unit so it might not be the best option, but this is how I did it for a hero unit.
You could make a dummy unit that is called <50% Health. Then make your passive that grants armor and damage bonus have that unit as a tech tree requirement. Then once your unit’s life becomes less than 50% you can add that dummy unit onto your map and activate that passive.
I used it to make an ability called last stand that is only usable once the hero reaches less than 25% health.
 

Wrda

Spell Reviewer
Level 26
Joined
Nov 18, 2012
Messages
1,887
If it's one unit then store it as a variable to keep track of it. If it's multiple units then add them to a Unit Group to keep track of all of them.

For one unit:

Events:
Every 0.10 seconds

Actions:
Set variable Health = The current percentage of your unit's life
If Health <= 50% and level of Armor Bonus not equal to 1 then do
Add ability Armor Bonus to your unit
Add ability Damage Bonus to your unit​
Else if Health >50% and level of Armor Bonus equal to 1 then do
Remove ability Armor Bonus from your unit
Remove ability Damage Bonus from your unit​
-------------------------------------------------------------------------
For multiple units:

Events:
Every 0.10 seconds

Actions:
Pick every unit in Health Unit Group and do
Set variable Health = The current percentage of picked unit's life
If Health <= 50% and level of Armor Bonus not equal to 1 then do
Add ability Armor Bonus to picked unit
Add ability Damage Bonus to picked unit​
Else if Health >50% and level of Armor Bonus equal to 1 then do
Remove ability Armor Bonus from picked unit
Remove ability Damage Bonus from picked unit​
--------------------------------------------------------------------------
Armor Bonus and Damage Bonus would be based on the Claws of Attack bonus damage and Ring of Protection bonus armor abilities. You could also use a Dummy Unit to cast Inner Fire on your unit to add Armor and Damage. Although, it would be dispellable since it's a buff.
There's literally a unit event for this... specially for single units...
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,542
Sure, if the unit is preplaced you could do that too. Just change the event.

I'm not going to assume that though. What if he wants Grunts trained from Barracks to have this passive ability or something.

And the "there's literally... sigh..." attitude gets old real quick.
 
Last edited:
Level 8
Joined
May 21, 2019
Messages
435
Sure, if the unit is preplaced you could do that too. Just change the event.

I'm not going to assume that though. What if he wants Grunts trained from Barracks to have this passive ability or something.

And the "there's literally... sigh..." attitude gets old real quick.

You can add the event through a trigger once the unit enters the game. This approach would work fine for a handful of heroes, but you'd need something to clean up the actions if the plan is to use the effect on regular units.
 
Status
Not open for further replies.
Top