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

Tool for converting unit id into order id

Status
Not open for further replies.
Okay, so the only way I can find out what the order id of a 'construct building A' is is to do call BJDebugMsg(I2S(GetIssuedOrderId())). That's fine and all, but it's annoying and time consuming. Basically, I need something to convert, for example, 'aray' into '1634886009'. I had found a website that could do that conversion, but it was a while back and I can't find it anymore. I don't know if the conversion is decimal, hexadecimal, or what have you. I'm bad at this.
 
Level 16
Joined
Mar 25, 2016
Messages
1,327
Turn Item raw code into item ID
https://www.thehelper.net/threads/turn-item-raw-code-into-item-id.116197/
I recently stumbled upon this. I think you will find all the information there.
The raw code to ID conversion used by Warcraft 3 involves ASCII.
For example, A = 65, B = 66, a = 97, etc.

In order to convert it into the ID, the first character is the series is multiplied by 256^3, the second character is mulitplied by 256^2, the third by 256, and the last by 1.

So, let's say you've got a code of pghe:
p = 112
g = 103
h = 104
e = 101

Therefore, the ID will be:
(112 * 256^3) + (103 * 256^2) + (104 * 256^1) + (101 * 256^0)
=2091537900

I've attached a map as well so you can see how the triggers work.
The same is applied for adding/removing abilities, which is what the map was initially used for. I quickly changed a few things around so it creates items instead.

Oh, and it's GUI. :thup:
 
I'm trying to replicate something similar to the protoss warp-in mechanic from sc2. When the builder is ordered to build a structure, the game detects a point order. If that builder can't move/turn, the order is cancelled right then and there, but the order given is registered nevertheless. Depending on the order, I can tell a dummy builder to build something specific.
JASS:
local integer IssuedOrder = GetIssuedOrderId()

if IssuedOrder == [I]1634886009[/I] then
    //Order dummy to build 'aray'.
elseif IssuedOrder == [order id] then
    //etc...
I've used this system before, so I know it works. I just need a convenient way to find the order id from the unit id. I guess it wouldn't be needed if I could there was a native that converts GetIssuedOrderId() back to it's 'aray' form.
 
Status
Not open for further replies.
Top