Unit to integer

krainert

Member
Reaction score
10
Hey people,

I need to acquire unique integer ID's for units. Is there a clever way of doing this?

Thanks.
 
Reaction score
456
[ljass]GetHandleId[/ljass]

Though, depending on your needs, even better solution could be some unit indexing system. There's quite a few of them around.
 

krainert

Member
Reaction score
10
Thanks.
How is it that GetHandleID is inferior?
Also, if I use GetHandleID, is there a way to convert from a handle to a unit?
 

Laiev

Hey Listen!!
Reaction score
188
[ljass]GetHandleId[/ljass] return the id of that handle, which is much bigger then just 8190.
 

PurgeandFire

zxcvmkgdfg
Reaction score
509
Thanks.
How is it that GetHandleID is inferior?
Also, if I use GetHandleID, is there a way to convert from a handle to a unit?

I think you might be able to with fogstate typecasting. (I2U see the typecasting library by kingking) However, that is pretty slow and not really necessary. Instead, you should just use a unit indexing system because:
1) It will allow you to use arrays really easily to store unit data.
2) You can retrieve the corresponding unit through GetUnitById() [which is what you are trying to do]

GetHandleId() is good, but you usually end up having to use hashtables unless you subtract a high enough number to make it in the array range. (0x100000) That method is unreliable though.
 

krainert

Member
Reaction score
10
Thanks again. I think I got the non-LUA UnitIndexer to work, but is using this over the LUA one a problem?
(The LUA variant required some other LUA stuff which failed installation)
 

luorax

Invasion in Duskwood
Reaction score
67
Well, Nes' added all that LUA requirements to avoid rawcode collision, that's all. Using the non-lua one is just fine.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top