UnitGetType
string UnitGetType (unit u);
Type of the unit.
Parameters
- unit u
Unit to get the type
Return value
string - Type of the unit. Can be one of:
- "Observer" (c_PU_Observer)
- "Marauder" (c_TU_Marauder)
- "Corruptor" (c_ZU_Corruptor)
- ... full list ...
Examples
- Example: Sample Usage
void Sample(unit u) { string type = UnitGetType(u); if (type == c_PU_WarpPrism) { // Warp Prism } if (UnitTypeTestAttribute(type, c_unitAttributeStructure)) { // Structure } if (UnitTypeTestFlag(type, c_unitFlagWorker)) { // Worker } }
- 1 comment
- 1 comment
- Reply
- #1
Noio Dec 06, 2010 at 12:44 UTC - 0 likesThough the return type is a string, the GUI doesn't know. In the GUI the return type is "UnitType", and it doesn't allow you to do an implicit cast, so some custom script is required to use this value for Catalog entries.
website: www.noio.nl