HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Getting and storing a units Maximum HP

08-24-2007, 01:11 PM#1
chobibo
Is there a blizzard.j or common.j function that could get a units maximum HP? Or I really need to use conditions to compare a units max hp againts its current hp?
What i want to do is to be able to set to a variable a units maximum HP but i can't find the function I need. Thanks for any help.
08-24-2007, 01:41 PM#2
cohadar
Collapse JASS:
    set life = GetUnitState(GetTriggerUnit(), UNIT_STATE_LIFE)
    set maxLife = GetUnitState(GetTriggerUnit(), UNIT_STATE_MAX_LIFE)
    set percentLife = GetUnitLifePercent(GetTriggerUnit())

You probably could not find this functions in GUI because they return real values
and you were looking integer functions.
08-24-2007, 01:44 PM#3
chobibo
Thanks man! you were right, I was referencing on GUI functions because I still am new to jass. Thanks for the helpful info. sorry but i cant rep u again.
08-24-2007, 02:04 PM#4
CommanderZ
They are all in Gui - in Real Comparsion section. Are when you are setting real variable.
08-24-2007, 05:32 PM#5
chobibo
Ive been trying to look for it but i cant find it, I tried using a real type variable now, but the only options available are life percentage which holds the value of the current hp percentage of the unit. Im using the set variable = value option btw. I think I'll stick with Jass.
08-24-2007, 06:40 PM#6
Pytho
Sticking with Jass is a good idea. I think noone here wants to convince you to use GUI, espacially if you know how to do it in Jass, but for the sake of completeness:
You have to select "Unit - Property". Than you can select life, max life, mana and max mana.
08-24-2007, 06:50 PM#7
Histenchist
Trigger:
Set Life = (Life of (Triggering unit))
Click image for larger version

Name:	blaba.JPG
Views:	15
Size:	23.1 KB
ID:	28283
Like that.
Attached Images
File type: jpgblaba.JPG (23.1 KB)
08-24-2007, 07:02 PM#8
chobibo
Are you guys using WEU? I tried those things you mentioned but all i find are; Life of, Percentage of life, Percentage of mana; my WE doesnt have any fields that has Max mana or Life. Thanks for trying to help guys.
08-24-2007, 07:15 PM#9
Histenchist
Look at the picture I attached, it's under unit - property just over the other unit stuff.
08-25-2007, 03:24 AM#10
Castlemaster
Max Life of Unit is listed under "Unit property". One of the options is "max life".
EDIT: bah! Redundant post. My bad.
08-25-2007, 03:51 PM#11
chobibo
Wtf im so stupid lol, now i see it thanks guys. I forgot to check the Life data field, it was under unit property and was inside the life option. Thanks for the picture and for pointing it out again. + rep man for your help!