Perfect IsUnitAlive

quraji

zap
Reaction score
144
>I don't have WC3 at work.

Ah. Too lazy to do your job then :p

>Thanks, that's good to know...

Yeah.
I tried testing it with heroes (in light of GetUnitXCost not working with them, you never know...):
JASS:
function AnHero takes nothing returns nothing
    local unit hero = CreateUnit(Player(0), 'Hpal', 0., 0., 0.)
    call KillUnit(hero)
    if (UnitAlive(hero)) then
        call BJDebugMsg("Alive")
    else
        call BJDebugMsg("Dead")
    endif
    call ReviveHero(hero, 0., 0., true)
        if (UnitAlive(hero)) then
        call BJDebugMsg("Alive")
    else
        call BJDebugMsg("Dead")
    endif
endfunction


Dead, then Alive. This function is too good..
 

Azlier

Old World Ghost
Reaction score
461
Hmm. It returns dead. How incredibly odd.

Well, we found one (minor) flaw. Why can't we have anything perfect?!
 

Sevion

The DIY Ninja
Reaction score
413
Well... you can't have everything :3

Besides, you can always just store a boolean when a unit dies and has reincarnation that's not on cooldown :3

Then again, we all need a single function to do all our stuff huh?

JASS:
native Sex takes player p returns boolean


If you pass an ugly person, it returns false. If you pass a beautiful person, it returns true :3
 

Jesus4Lyf

Good Idea™
Reaction score
397
Hmm. It returns dead. How incredibly odd.

Well, we found one (minor) flaw. Why can't we have anything perfect?!
How's that a flaw... I'm thinking of when I'd use this (like buff/damage all units in AoE), and reincarnation should count as dead in those situations... :)
 

Azlier

Old World Ghost
Reaction score
461
True, it may be better in the end. But it shouldn't return dead.
 

Jesus4Lyf

Good Idea™
Reaction score
397

Azlier

Old World Ghost
Reaction score
461
So in your eyes it is perfect, in mine it is imperfect but is just as good as perfect or something.
 

Jesus4Lyf

Good Idea™
Reaction score
397

Azlier

Old World Ghost
Reaction score
461
Alive. After any sort of wait, dead.

Flaw #2 :(
 

Rushhour

New Member
Reaction score
46
It's christmas soon,.. I wish a native that gets the manacosts of spells :D
And properly working ability and buff fields ready to be edited !

Jesus, can you talk to your daddy :D
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top