Lua GetUnitByGUID

From ArcEmu-Wiki
Jump to: navigation, search


Targets the unit that owns the GUID you specify in parenthesis, unless target does not exist. Each unit, player and object are given a specific GUID (Globally Unique Identifier), they can be found by either using ".npc info", ".go info" or ".playerinfo <target>" for the corresponding targets, or by going into the database and finding it in the "id" column in these tables:

Objects: gameobject_spawns
NPCs / Units: creature_spawns
Players: characters

Useful if you need to target a friendly unit, and GetRandomFriend() isn't working for you. GUID is also known as the SQL ID.


function Target_Unit(Unit, Event)
local target = Unit:GetUnitByGUID(5412)
 if target ~= nil then
   Unit:FullCastSpellOnTarget(300, target)
Personal tools