WolfieeifloW
WEHZ Helper
- Reaction score
- 372
I didn't want to just add this question into my other thread (Since that's against the rules ) so I posted this.
I have a spell that heals the hero for 3% health when it procs.
So, I've used [ljass]SetUnitState()[/ljass].
Here's the line of code it uses:
The BJ displays 19.5.
However, here's my results from testing.
The hero has 650HP maximum.
The hero started at 366 current HP.
Ideally, he should have been healed up to 385HP with the spell.
Instead, after the spell goes off, he is healed up to 416HP.
Which means he healed for 50HP, instead of 19HP.
Am I missing something here?
What I'm thinking that code should do is:
Get the unit's current life, then add (maxHP * 0.03).
I have a spell that heals the hero for 3% health when it procs.
So, I've used [ljass]SetUnitState()[/ljass].
Here's the line of code it uses:
JASS:
private function Heal takes nothing returns real
return 0.03
endfunction
call BJDebugMsg(R2S(GetUnitState(d.attacker, UNIT_STATE_MAX_LIFE) * Heal()))
call SetUnitState(d.attacker, UNIT_STATE_LIFE, GetUnitState(d.attacker, UNIT_STATE_LIFE) + (GetUnitState(d.attacker, UNIT_STATE_MAX_LIFE) * Heal()))
The BJ displays 19.5.
However, here's my results from testing.
The hero has 650HP maximum.
The hero started at 366 current HP.
Ideally, he should have been healed up to 385HP with the spell.
Instead, after the spell goes off, he is healed up to 416HP.
Which means he healed for 50HP, instead of 19HP.
Am I missing something here?
What I'm thinking that code should do is:
Get the unit's current life, then add (maxHP * 0.03).