• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Is possible Get Unit Id?

Status
Not open for further replies.
Level 7
Joined
Dec 11, 2004
Messages
94
I found this.. I don't know anything about coding this, donno any coding and never did jass in warcraft3, but it looks backwards for whats trying to be accomplished...

native unit UnitFromId (int id);

Could assign a custom value+1 for every unit in-game and being created... Own custom unitID.. *cough*
 
Level 7
Joined
Jan 29, 2008
Messages
47
I tried this one:
  • Debug - Display (Text((String(Test Ability Name)))) as debug output using Type 1, and Do display it in the game window
I set the name of the test ability to 'Test Ability Name' and it's ID to 'TestAbilityID'. This debug message returned 'TestAbilityID', so I guess this is what you are searching for.

I used the game link to string conversion. Though it's a bit tricky to use. Take note that, after opening the game link window, you can choose the type and link type at the top of this window. There you can choose any game link, like units, behavior, effects, ect.
 
Level 7
Joined
Dec 11, 2004
Messages
94
I tried this one:
  • Debug - Display (Text((String(Test Ability Name)))) as debug output using Type 1, and Do display it in the game window
I set the name of the test ability to 'Test Ability Name' and it's ID to 'TestAbilityID'. This debug message returned 'TestAbilityID', so I guess this is what you are searching for.

I used the game link to string conversion. Though it's a bit tricky to use. Take note that, after opening the game link window, you can choose the type and link type at the top of this window. There you can choose any game link, like units, behavior, effects, ect.

What I'm looking for is like the unit ID in Warcraft 3, every individual unit in-game had a 4 digit numeral identifier, such as Footman '0012', Footman '0013', and Grunt '0014', or something like that. Those numbers can be used as arrays for variables in physic systems whereas you select every unit as a unit-group, and every single unit has their own array. This number could also be viewable in the warcraft 3 editor in triggers and by selecting units, whereas in the starcraft 2 editor, the only thing displayed is the unit name and cords.
 
Level 11
Joined
Aug 1, 2009
Messages
963
Create it yourself.

For each unit in a map, give it a unique integer custom value which corresponds to array spots. Whenever a unit dies, pick the unit with the highest custom value and move all of its info to the dying unit's slot in the array.
 
Level 4
Joined
May 25, 2007
Messages
55
Create it yourself.

For each unit in a map, give it a unique integer custom value which corresponds to array spots. Whenever a unit dies, pick the unit with the highest custom value and move all of its info to the dying unit's slot in the array.

He doesn't need to, blizzard already put one in... However for some reason I think they changed it.

Before a recent patch i'm assuming the function
UnitGetPropertyInt(u, 24, c_unitPropCurrent)
would return the unique id integer for the unit u, yet for some reason it's not working anymore.

I got this info from
http://www.sc2mapster.com/api-docs/functions/unit-get-property-int/
and when I first used it it was working fine. Though I'm assuming they might have added a property and changed the unique ID's integer.

I was using it in my map for a trade caravan but then after a recent patch they stopped working right, I noticed through a debug the functions topped getting the unique ID.

I'm looking to see what blizzard changed it too, but it's definately in there.

Edit: Nevermind I just found it, apparently to make it work you gotta put any value 24 or above, but since 24 and such don't work, that can mean blizzard probably put something there, don't know what it is but since it just has to be anything above, you can just use something insane like 9000.

so to get a units unique ID, use the function

UnitGetPropertyInt(u, 9000, c_unitPropCurrent)

9000 can be any number thats really high, 24 and below will give specific unit values like health and health percentage. But any number that doesn't have a specific value will return the unique ID.

Hope this was able to help.
 
Status
Not open for further replies.
Top