Expelliarmus
Where to change the sig?
- Reaction score
- 48
You know when you try to
[the unit's health is greater than the increase value (100; call Set 225 = 200 + 100)] and it doesn't work? Anyone know a solution to this?
This is my solution, but it doesn't seem to work.
Thanks
JASS:
local real mana = GetUnitState(GetFilterUnit(), UNIT_STATE_MANA)
call SetUnitState(GetFilterUnit(), UNIT_STATE_MANA, mana + 100 )
[the unit's health is greater than the increase value (100; call Set 225 = 200 + 100)] and it doesn't work? Anyone know a solution to this?
This is my solution, but it doesn't seem to work.
JASS:
function Increase_Mana takes nothing returns boolean
local real diff
local unit caster
local real increase
local real mana
if true then
set caster = GetTriggerUnit()
set mana = GetUnitState(caster, UNIT_STATE_MANA)
set increase = GetUnitState(GetFilterUnit(), UNIT_STATE_MANA)
if increase < 150 then // less than substract amount
call SetUnitState(GetFilterUnit(), UNIT_STATE_MANA, 0 )
call SetUnitState(caster,UNIT_STATE_MANA, mana + increase ) // assume that caster mana > 150
else
call SetUnitState(GetFilterUnit(), UNIT_STATE_MANA, mana - 150 )
// caster condition : less than 150?
set diff = GetUnitState(caster, UNIT_STATE_MAX_MANA) - GetUnitState(caster, UNIT_STATE_MANA) // mana left
if diff <= 150 then
call SetUnitState(caster , UNIT_STATE_MANA, GetUnitState(caster, UNIT_STATE_MANA) + diff)
call BJDebugMsg("less")
else
// greater than spellevel
call SetUnitState(caster, UNIT_STATE_MANA, GetUnitState(caster , UNIT_STATE_MANA) + 150)
call BJDebugMsg("greater")
endif
endif
endif
set caster = null
return false // no group formed
endfunction
Thanks