Objective: This library indexes units so they can be referenced by Index Numbers
auto generated and uniquely assigned to each unit in the system.
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)
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.
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.