Created
February 19, 2015 17:59
-
-
Save StinkyTwitch/1fc692b1199d64eae1e5 to your computer and use it in GitHub Desktop.
Get Objects Health using Descriptor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local _,_,_,_,_, target_id,_ = strsplit("-",UnitGUID("target")) | |
local object_pointer = nil | |
local total_objects = ObjectCount() | |
for i=1, total_objects do | |
local _, object = pcall(ObjectWithIndex, i) | |
local _, object_exists = pcall(ObjectExists, object) | |
if object_exists then | |
local _, object_type = pcall(ObjectType, object) | |
local bitband = bit.band(object_type, ObjectTypes.Unit) | |
local type, zero, server_id, instance_id, zone_uid, unit_id, spawn_id = strsplit("-",UnitGUID(object)) | |
if bitband > 0 then | |
if unit_id == target_id then | |
local object_health = ObjectDescriptor(object, 0xEC, ObjectTypes.Unit) | |
print(tonumber(object_health,16)) | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment