[JASS] GetUnit name from UnitType

Status
Not open for further replies.
Level 9
Joined
Jan 15, 2008
Messages
235
Hi guys,
This is my 1st time that I'm asking for jass help

I would like to get unit name by giving unit type to function, i tried something but i got "custom_xxxx" where xxxx is raw data of my unit...

Is there any notlaggy fast way to solve this :razz:

ps. sorry if its something easy, but i couldnt solve it :hohum:
 
Hi guys,
This is my 1st time that I'm asking for jass help

I would like to get unit name by giving unit type to function, i tried something but i got "custom_xxxx" where xxxx is raw data of my unit...

Is there any notlaggy fast way to solve this :razz:

ps. sorry if its something easy, but i couldnt solve it :hohum:


Yes there is, use:

JASS:
constant native GetObjectName               takes integer objectId          returns string
 
You can use either one. GetObjectName is probably mainly for globally retrieving since it takes a rawID, while GetUnitName is for a specific object...

They both return the same thing though. Even when dealing with a hero. But if you want a hero's proper name, use this:
JASS:
native          GetHeroProperName   takes unit whichHero returns string
 
off topic but not so much :p

It seems (i didn't test all the functions ....) that in general a specific function is a little faster that an generic one, ofc i talk about functions with the same number of arguments.

For example GetUnitX is faster than GetWidgetX.

i tested it with japi
 
strange... at all unit is the extended version of widget
hmm maybe it spends some on converting unit to widget
 
Status
Not open for further replies.
Back
Top