HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Finding a Unit's or Item's Name?

12-24-2006, 08:40 AM#1
Ignitedstar
I think it's just me, but I haven't found a GUI function that allows one to find the triggering unit's unit type or even an item. What would actually be better is to the get the proper name of a hero.

What I'm to do is to make a game message that basically says, "[Hero 1] uses [Item Name] on [Hero 2]". The main problem is: How can I obtain a unit's or item's name? And I was to do this for a hero: How could I find the proper name of the hero?

A few unneeded examples:

Mountain King uses Potion on Archmage
Dark Ranger uses Mana Potion on Warden

I could do the same with skills, too:

Far Seer uses Chain Lightning on Footman

P.S. I don't really care whether if it's in GUI or JASS.
12-24-2006, 03:13 PM#2
wyrmlord
Collapse JASS:
constant native GetItemName     takes item whichItem returns string
constant native GetUnitName         takes unit whichUnit returns string

//For anything else, this should work

constant native GetObjectName               takes integer objectId          returns string
You might want to get a JASS editing program so you can easily look up functions.
12-26-2006, 07:46 PM#3
Ignitedstar
Cool, thanks! This'll come in handy.