→Example: Decomposing a GUID: Change to 4.0 NPC ID in scripts
m (→Example: Decomposing a GUID: add simple run command to section for getting the NCP ID in game) |
(→Example: Decomposing a GUID: Change to 4.0 NPC ID in scripts) |
||
| Line 29: | Line 29: | ||
A GUID can be thought of as being composed of multiple pieces of data. Consider "'''0xAABCCCDDDDEEEEEE'''", where: | A GUID can be thought of as being composed of multiple pieces of data. Consider "'''0xAABCCCDDDDEEEEEE'''", where: | ||
:; AA : unknown. | :; AA : unknown; Possible battlegroup identifier when used for players. | ||
:; B : unit type, mask with 0x7 to get: 0 for players, 1 for world objects, 3 for NPCs, 4 for permanent pets, 5 for vehicles. Temporary pets (Treants, Spirit Wolves, Water Elemental, Mirror Images, and Ghouls) are considered NPCs (3), even if talents or glyphs prevent them from expiring. | :; B : unit type, mask with 0x7 to get: 0 for players, 1 for world objects, 3 for NPCs, 4 for permanent pets, 5 for vehicles. Temporary pets (Treants, Spirit Wolves, Water Elemental, Mirror Images, and Ghouls) are considered NPCs (3), even if talents or glyphs prevent them from expiring. | ||
:; CCC : If the unit is a pet, CCCDDDD forms a unique ID for the pet based on creation order; if a world object, CCCDDDD is the object ID; otherwise unknown. | :; CCC : If the unit is a pet, CCCDDDD forms a unique ID for the pet based on creation order; if a world object, CCCDDDD is the object ID; otherwise unknown. | ||
:; DDDD : If the unit is an NPC, this is the hexadecimal representation of the NPC id. | :; DDDD : If the unit is an NPC, this is the hexadecimal representation of the NPC id. | ||
:; EEEEEE : If the unit is a player, this is a unique identifier based on creation order. Otherwise, this is a spawn counter based on spawn order. | :; EEEEEE : If the unit is a player, this is a unique identifier based on creation order. Otherwise, this is a spawn counter based on spawn order.<br>(For players it can be 7 digits long, so that its DEEEEEE) | ||
| Line 52: | Line 52: | ||
The last six digits, "008852" is the spawn counter. There will never be two "Mo'arg Weaponsmith", possible even never two mobs in the outside world, with the same spawn number. This spawn counter, combined with the rest makes it possible to always refer to exactly this "Mo'arg Weaponsmith", and not the one next to it. | The last six digits, "008852" is the spawn counter. There will never be two "Mo'arg Weaponsmith", possible even never two mobs in the outside world, with the same spawn number. This spawn counter, combined with the rest makes it possible to always refer to exactly this "Mo'arg Weaponsmith", and not the one next to it. | ||
A simple in game script command can be used to get the NPC ID from your target | A simple in game script command can be used to get the NPC ID from your target: ''Target NPC ID: 19755'' | ||
/run print("Target NPC ID:", tonumber((UnitGUID("target")):sub(-12, -9), 16)) | |||
More informative script: ''NPC ID("Mo'arg Weaponsmith") = 0x4D2B = 19755'' | |||
/run local a=strsub(UnitGUID("target"),7,10); print("NPC ID(\""..UnitName("target").."\") = 0x"..a.." = "..tonumber(a,16)) | |||
=== Cross-server and GUID "uniqueness" === | === Cross-server and GUID "uniqueness" === | ||
| Line 62: | Line 64: | ||
NPC GUID collisions have also been observed. It is unknown why or when in specific they occur, but differing mob types have had a NPC ID number which corresponded to an entirely different NPC. This is considered a very rare phenomenon. | NPC GUID collisions have also been observed. It is unknown why or when in specific they occur, but differing mob types have had a NPC ID number which corresponded to an entirely different NPC. This is considered a very rare phenomenon. | ||
== | == {{C-inline}} 4.0 changes to NPC ID == | ||
Along with the Live [http://www.wowwiki.com/Patch_4.0.1 4.0.1 patch (build 13164)], the NPC portion has moved 2 digits to the left, to <font color="#F6ADC6">CC</font><font color="#ADFF2F">DD</font> instead of <font color="#ADFF2F">DDDD</font>. | |||
*Before: (9th to 12th digit) | |||
0xF13000<font color="#ADFF2F">73AB</font>06AE87,"King Varian Wrynn" | |||
*After: (7th to 10th digit) | |||
0xF130<font color="#ADFF2F">73AB</font>00001BB4,"King Varian Wrynn" | |||
The NPC portion of this is 0x73AB in hex, and a NPC ID of 29611 in decimal. | |||
The NPC portion of this is | |||