Objective: This library indexes units so they can be referenced by Index Numbers
auto generated and uniquely assigned to each unit in the system.
Functions
To setup a unit into the system use the function: DUI_Setup(Unit)
To retrieve a units index use the function: DUI_Get_Index_From_Unit(Unit)
To retrieve the unit associated with an index number use: DUI_Get_Unit_From_Index(Index)
Customization
The system uses a DataTable backend, so there is no pre-defining to do regarding size.
By default the system enters every unit that enters the map into the system
to change this modify the DUI_Init trigger to whatever you need or call DUI_Setup(Unit) in your own custom function after disabling DUI_Init.
This library has a DEBUG feature, to enable this modify the DUI_ALLOW_DEBUG variable and set it to true.
Then when in the map type debug in the chat to display unit indexes above their head.
Install Instruction:
1. Download Dustins Unit Indexing.SC2Lib from above link.
2. Open the map you want to use the library in.
3. Open the trigger dialog and make sure the View > Library menu is checked.
4. Right click the Library view area and click Import Library, find the library file you downloaded and open it.
5. Read the instructions on how to use the library.
[UPDATE 8/3/2013] I've Re-factored the code and updated this to use a DataTable so you will not have to worry about max array size anymore. This Library is completely plug and play with no configuration needed.
Uhm, I might be wrong, but wasn't a unique index per unit available anyway? Something along the lines of the 25th custom value, which automatically returned an index unique to that unit? I think, I did read this somewhere... again, I might be wrong, though.
Dustins Unit Indexing Library v1.5
Objective: This library indexes units so they can be referenced by Index Numbers
auto generated and uniquely assigned to each unit in the system.
Functions
Customization
to change this modify the DUI_Init trigger to whatever you need or call DUI_Setup(Unit) in your own custom function after disabling DUI_Init.
Then when in the map type debug in the chat to display unit indexes above their head.
Download Library: http://dl.dropbox.com/u/843426/Dustins%20Unit%20Indexing.SC2Lib
Download Test Map: http://dl.dropbox.com/u/843426/DustinsUnitIndexing.SC2Map
Install Instruction:
1. Download Dustins Unit Indexing.SC2Lib from above link.
2. Open the map you want to use the library in.
3. Open the trigger dialog and make sure the View > Library menu is checked.
4. Right click the Library view area and click Import Library, find the library file you downloaded and open it.
5. Read the instructions on how to use the library.
[UPDATE 8/3/2013] I've Re-factored the code and updated this to use a DataTable so you will not have to worry about max array size anymore. This Library is completely plug and play with no configuration needed.
Uhm, I might be wrong, but wasn't a unique index per unit available anyway? Something along the lines of the 25th custom value, which automatically returned an index unique to that unit? I think, I did read this somewhere... again, I might be wrong, though.
@Kueken531: Go
I wasn't aware of this feature, Ill check it out!
[EDIT] Didn't work for me.
@Kueken531: Go
The 25th custom value is the same as every other value. I use this value in my map and I don't have any bugs with it, so there you go :P
This library has been updated.