# Easy simple one :)

#### Hemske

Level 26
When a unit makes a spell, how do you make him take 10% of his max hp in a trigger? Can only find "set life to 100 %" but i want to deal damage equal to 10% of his max hp.

#### Amish_KOTP

Level 6
umm set hp to (convert real to integer) arithmetic .1 x max hero's hp. that should work
errr messed up...arithmetic max heros hp - .1 X max heros hp

#### Hemske

Level 26
Wait, did i get you now? Like this?
• Then - Actions
• Unit - Set life of (Triggering unit) to ((Percentage life of (Casting unit)) x 0.10)%

#### Amish_KOTP

Level 6
that takes 10% of his current hp.

#### Hemske

Level 26
But doesnt that make him to get 0,1 % of his hp? Isnt it like this?
• Unit - Set life of (Casting unit) to ((Life of (Casting unit)) x 0.90)%

#### Amish_KOTP

Level 6
Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) - ((Max life of (Triggering unit)) x 0.10))
thats the full function to make it take away 10% of his hp total. problem is with that he can die by casting the ability, but it is what you are asking for I believe.

#### Hemske

Level 26
I use this now:
• Unit - Set life of (Casting unit) to ((Max life of (Casting unit)) x 0.10)%
And it dit not work, nothing happened with his hp :/ and yes i want him to be able to die by using the ability.

#### Amish_KOTP

Level 6
err no that just sets the hp to 10% you forgot the extra arithmetic there...

Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) - ((Max life of (Triggering unit)) x 0.10))
thats the full function

#### Hemske

Level 26
Like this then? Unit - Set life of (Casting unit) to ((Life of (Casting unit)) - ((Max life of (Casting unit)) x 0.10))
-------------------
edit: yea it worked, thanks for the help +rep

#### Amish_KOTP

Level 6
exactly like that

Replies
11
Views
557
Replies
9
Views
242
Replies
4
Views
192
Replies
10
Views
581
Replies
9
Views
371