I know I could get the unit type of a unit but it has a space (which can be removed) and it doesn't always match the unit ID and it wouldn't work for heros.
Use Unit Type of Unit to get the unit type of the unit.
Then use Convert gamelink to String to get the string value of this unit type.
and there ya go, the Unit Type Id
If this does not give the desired result then create an action definition with custom script that does the following:
return type: String
parameter: gamelink <Gamelink Any>
Custom Script: return lp_gamelink;
use this action definition instead of Convert gamelink to String
Unit itself don't have own different ID. "Convert gamelink to string(Unit-Type)" or "Convert gamelink to string(Gamelink - Unit)" are both Unit-type references because every existing unit is instance/clone of it's Unit-Type.
If you mean unique ID of unit (like spawned units on map) than you need to use some custom Unit indexing system. There are few existing you can google them.
Thanks Helral! I had just thought it wouldn't give me the ID but the name or something instead. Not sure why I thought that :) And sorry everybody else, I should have been more specific but I didn't realize there were other possibilities.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I know I could get the unit type of a unit but it has a space (which can be removed) and it doesn't always match the unit ID and it wouldn't work for heros.
@Aramiri: Go
I think we may need a little more context to solve this problem.
@jcraigk: Go
No, you don't. Each unit is assigned an ID in the data editor. I'm asking for a way to retrieve it.
@Aramiri: Go
Use Unit Type of Unit to get the unit type of the unit.
Then use Convert gamelink to String to get the string value of this unit type.
and there ya go, the Unit Type Id
If this does not give the desired result then create an action definition with custom script that does the following:
return type: String
parameter: gamelink <Gamelink Any>
Custom Script: return lp_gamelink;
use this action definition instead of Convert gamelink to String
Unit itself don't have own different ID. "Convert gamelink to string(Unit-Type)" or "Convert gamelink to string(Gamelink - Unit)" are both Unit-type references because every existing unit is instance/clone of it's Unit-Type.
If you mean unique ID of unit (like spawned units on map) than you need to use some custom Unit indexing system. There are few existing you can google them.
@Aramiri: Go
Okay so apparently what you meant was "each unit *type* is assigned an ID in the editor".
@Helral: Go
Thanks Helral! I had just thought it wouldn't give me the ID but the name or something instead. Not sure why I thought that :) And sorry everybody else, I should have been more specific but I didn't realize there were other possibilities.