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

[Solved] Get Unit ID <-> String

Status
Not open for further replies.
Hello, just a quick question, how do I convert Unit ID (ex. Custom Building 1 (H000), another Custom Building (H001)) to a String? (ex. Custom Building 1 == H000 -> True)

What I am trying to achieve here is to the store unit ids to the UnitString array. The buildings are chests for example, and everytime I interact with them the items in it will be different (I have made an Interface made of destructibles and it will update everytime I interact with different chests - This thing is already done).

Arrays
UnitString[64], Item01[64], Item02[64], Item03[64], Item04[64]

Sample Data
H000, Pendant something, Boots something, Helmet something, No Item
H001, Claw, No Item, No Item, Helmet 2 something, No Item
 
Last edited:
Level 45
Joined
Feb 27, 2007
Messages
5,578
Why do you want them to be strings? They are integers internally, just in a different base. You can store and compare them as integers without having to do anything in JASS; GUI also has unit type variables which are just integers under the hood.

Some of the new ‘object field’ natives can read object editor data so you could get the OE name of the unit that way rather than its rawcode.
 
Status
Not open for further replies.
Top