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

Create unit based on internal ID?

Status
Not open for further replies.
Level 1
Joined
Oct 4, 2016
Messages
5
Preface: I know nothing of JASS and haven't worked with WC3 in years, I just recently started messing around in the editor again and was wondering how one could go about this.

I want to be able to create any unit by typing in a text string with the raw data ID as displayed in the editor.

IE "create hdhw" or just "hdhw" would create a Dragonhawk Rider or "uabo" an Abomination at the location of the mouse, or if not possible then at a specific region.

I feel like I should be able work something with converting a string to unit type, but I haven't been able to wrap my head around making that work the way I want.
 
Level 13
Joined
Mar 24, 2013
Messages
1,105
To get the raw id of a unit, you press cntrl D in the object editor.

It's actually an integer not a string. And it needs to be surrounded in single quotes. 'hfoo' for example

If you want to create an footman when you type that. You need to read the typed string and if its an accepted unit, then it fetches the raw id from a catalog that you would make.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,287
IE "create hdhw" or just "hdhw" would create a Dragonhawk Rider or "uabo" an Abomination at the location of the mouse, or if not possible then at a specific region.
As mentioned by Wietlol, an ASCII parser is needed to convert the 4 character code into an integer. This would be done by getting the numeric value of each character. These 4 different 8 bit values can then be joined together into a 32bit integer by multiplying by 256 (replace left bitshift by 8) and addition (replace bitwise or). The integer can then be used as a type by various natives.
 
Status
Not open for further replies.
Top