12.07.2015 Views

Wiley-World.of.Warcraft.Programming.A.Guide.and.Reference.for.Creating.WoW.Addons

Wiley-World.of.Warcraft.Programming.A.Guide.and.Reference.for.Creating.WoW.Addons

Wiley-World.of.Warcraft.Programming.A.Guide.and.Reference.for.Creating.WoW.Addons

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

192 Part II ■ <strong>Programming</strong> in <strong>World</strong> <strong>of</strong> <strong>Warcraft</strong>NOTE Not every function will work correctly on all unit IDs. The documentationin Chapter 27 explains those cases.Table 11-4: Base Unit IDsUNIT ID REFERS TO...player The character controlled by the player.petVehicletargetfocusmouseoverpartyNpartypetNraidNraidpetNarenaNnpcnoneThe player’s pet.The player’s vehicle.The player’s target (equivalent to “playertarget“).The player’s focus target.The unit underneath the mouse cursor. Includes characters in the3-D world <strong>and</strong> any frame with a set unit attribute.The N th party member where N is a number from 1–4. None <strong>of</strong> theparty unit IDs refers to the player.The N th party member’s pet.The N th raid member where N is a number from 1 to however manymembers there are in the raid. The highest N always refers to theplayer, <strong>and</strong> the lowest N always refers to the raid leader. There is nocorrelation between the N <strong>for</strong> raid units <strong>and</strong> the N <strong>for</strong> party units.The N th raid member’s pet.The N th enemy in the arena.The currently selected NPC. UnitExists only returns true <strong>for</strong> thisunit while you are interacting with an NPC (that is, when you areturning in a quest, using a vendor, <strong>and</strong> so on).No unit. It was created to allow activation <strong>of</strong> the target selectioncursor even when you are targeting something vulnerable to thespell you are casting.In addition to these token-based unit IDs, most functions will accept thename <strong>of</strong> a party or raid member. For example, if you have a party membercalled ‘‘Healadin’’ you could query his health by running:/run print(UnitHealth(“Healadin“))

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!