• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Hash fail?

Status
Not open for further replies.
Level 15
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
 
Status
Not open for further replies.
Top