- Joined
- May 9, 2014
- Messages
- 1,810
Hello there, reader.
I thought of a certain approach on how to properly detect change in max life.
Now, I'm not sure if this will work, since I don't have my test environment up and running at the moment, but here's the script:
I thought of a certain approach on how to properly detect change in max life.
Now, I'm not sure if this will work, since I don't have my test environment up and running at the moment, but here's the script:
JASS:
library UnitMaxStateDetect
//# +nosemanticerror
private function I2F takes integer i returns real
set i = i
return i
endfunction
//# +nosemanticerror
private function F2I takes real r returns integer
set r = r
return r
endfunction
private function clearInt takes integer i returns integer
set i = i
return i
endfunction
private function clearReal takes real r returns real
set r = r
return r
endfunction
function TriggerRegisterUnitMaxLifeEvent takes trigger t, unit u, limitop operation returns event
return TriggerRegisterUnitStateEvent(t, u, UNIT_STATE_MAX_LIFE, operation, clearReal(I2F(R2I(GetUnitState(u, UNIT_STATE_MAX_LIFE)))) )
endfunction
function TriggerRegisterUnitMaxManaEvent takes trigger t, unit u, limitop operation returns event
return TriggerRegisterUnitStateEvent(t, u, UNIT_STATE_MAX_MANA, operation, clearReal(I2F(R2I(GetUnitState(u, UNIT_STATE_MAX_MANA)))) )
endfunction
endlibrary
Last edited: