• 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.

[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:
 
Level 5
Joined
Oct 27, 2007
Messages
158
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
 
Level 17
Joined
Apr 27, 2008
Messages
2,455
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
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
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.
Top