Unit_state_max_life

substance

New Member
Reaction score
34
I've been messing around with healing units VIA triggers but i've run into a problem.

JASS:
call SetUnitState(data.targetunit, UNIT_STATE_LIFE, GetUnitState(data.targetunit, UNIT_STATE_MAX_LIFE))
call BJDebugMsg("unit's current HP is "+R2S(GetUnitState(data.targetunit, UNIT_STATE_LIFE)))


The unit's max HP is 615, and that debug mesage says "unit's current HP is 615.00", so obviously wc3 thinks it did it's job but the unit actually doesnt have full HP (it sits around ~580).

Is there a bug im not aware of?
 

Steel

Software Engineer
Reaction score
109
JASS:
call SetUnitState(data.targetunit, UNIT_STATE_LIFE, GetUnitState(data.targetunit, UNIT_STATE_MAX_LIFE))


SetUnitState(<Target>, UNIT_STATE_LIFE, <New Value>)
In this situation your <New Value> is set equal GetUnitState(<Target>, UNIT_STATE_MAX_LIFE)

You set the unit's current life to its maximum life? I've done this before, there may be something wrong with the oop reference here, but it seems odd. Ill take a look
 

substance

New Member
Reaction score
34
........uhh, I think you mis-understand.

I WANT to set the unit's current HP to his max HP.

**edit

I think I figuired it out, I'm changing the values too quickly and it isnt giving the engine enough time to process the changes. I threw in a TriggerSleep and it worked.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top