- Joined
- Nov 30, 2007
- Messages
- 1,202
For some reason the trigger fires even though the dying unit (filtering unit is not FIRE_TYPE, its really weird. Ah damn GetFilterUnit() was the issue.
JASS:
static method create takes unit target, real dpsMax returns Fire
local real x = GetUnitX(target)
local real y = GetUnitY(target)
local thistype f = .allocate()
set f.u = CreateUnit(Player(PLAYER_NEUTRAL_AGGRESSIVE), FIRE_TYPE, x, y, 0)
set f.target = target
set f.dpsMax = dpsMax
call SaveInteger(hash, GetHandleId(f.u), 1, GetUnitUserData(target))
call SetWidgetLife(f.u, GetUnitState(f.u, UNIT_STATE_MAX_LIFE)*FIRE_START_HEALTH)
//call SetUnitState(f.u, UNIT_STATE_LIFE, GetUnitState(f.u, UNIT_STATE_MAX_LIFE)*FIRE_START_HEALTH )
call f.checkState()
return f
endmethod
private function OnDeath takes nothing returns boolean
local unit u = GetFilterUnit()
if GetUnitTypeId(u) == FIRE_TYPE then
call BJDebugMsg("lol")
call fire[LoadInteger(hash, GetHandleId(u), 1)].destroy()
endif
return false
endfunction