# [Solved]How to prevent from dying with hp cost ability

Status
Not open for further replies.

#### SenPie69

Level 5
just as the title says, i have this spell that consumes 20% of the HP but i want to make it like huskar's lifebreak in DotA where base of his hp%left as cost (preventing him from dying like with 60/2000 HP and that spell is like cost 20% of the remaining hp to cast therefore he won't die after casting with low hp) [sry i find it hard to explain this] and ends up dying if the caster has 20% or less HP

#### Devalut

Level 24
set life to X [Max (1.00), ( Unit Health - (Max health x 0.20))]

#### SenPie69

Level 5
set life to X [Max (1.00)
^ that part, what configure action is that?

#### Devalut

Level 24

I.e.
60/2000 health caster would be given two options:
1. 1.00 hp
2. -340.00 hp (60 - (2000 * 0.20))
Max always chooses the (Max)imum value meaning that 1 in the event of low hp will always be chosen.

#### SenPie69

Level 5

im confused after the Set Life (To Value) i don't see arithmetic/math option after clicking the first one[set life of triggering unit] (unless that feature is on reforge coz i use 1.27ver)

#### Devalut

Level 24
Now this is a really difficult step, hold onto your butt...

try the other one

#### SenPie69

Level 5
Now this is a really difficult step, hold onto your butt...

try the other one

View attachment 385852
already done that, i did both percentage and value, still gets killed with less of the conditions cost
i put 200% as 20% cost

#### Devalut

Level 24
already done that, i did both percentage and value, still gets killed with less of the conditions cost
View attachment 385853 i put 200% as 20% cost

According to that you are simply taking the life of the triggering unit, subtracting 200.00 and setting the resulting value as its new percentage of it's life, note the % at the end of the line.
Read over the screen shots and use Set life to (VALUE)
End result should look like:
• Unit - Set life of (Triggering unit) to (Max(1.00, ((Life of (Triggering unit)) - ((Max life of (Triggering unit)) x 0.20))))
Not
• Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) - 200.00)%

#### SenPie69

Level 5

so i did but still gets killed with less than 20% of the health

#### Devalut

Level 24
The number of brackets in your screenie tell me that you're a big fat fibber.

In my trigger I have value 1 as (1.00), and value2 as (Life of (Triggering unit)) - ((Max life of (Triggering unit)) x 0.20)))

You have value1 as (1.00), but have value2 as (Life of (Triggering unit) and then you go on to subtract ((Max life of (Triggering unit)) x 0.20) from outside Max(x,y).

Review the screenshots earlier and try again.

#### SenPie69

Level 5
Its now working, thank you very much, but i will forgive the insult as you are knowledgeable to triggers, tho im still learning but i know one or two stuffs... then again thank you

Status
Not open for further replies.

Replies
7
Views
962
Replies
1
Views
400
Replies
10
Views
574
Replies
2
Views
426
Replies
1
Views
1K