Posted by kevinmd88 on Wed, 17 Jul 2013 18:32:53
I'm attempting to write a section of code that will monitor a specific unit's health and do some stuff at a percentage. Specifically, the "boss1" unit. More specifically, Megaera.
I tried registering the event to my addon object (I'm using AceAddon) like so:
MyAddon = LibStub("AceAddon-3.0"):NewAddon("MyAddon", "AceEvent-3.0"); MyAddon:RegisterEvent("UNIT_HEALTH_FREQUENT", "HealthChanged"); function MyAddon:HealthChanged(u) if UnitName(u) == "Name of desired unit" then --Do stuff... end end
But the event doesn't fire a single time... Which has made me wonder, does this event need to be registered to the specific unit frame I want to monitor? Something like
And if this is the case, how do I access a specific unit frame in this manner? I don't recall ever coming across a "GetUnit" function or anything like that...
Any and all guidance is appreciated :) Thanks!
Posted by jnwhiteh on Thu, 08 Aug 2013 05:16:51
You may need to use RegisterUnitEvent in order to get that event. It's worth testing this out with something simple like a mob in the world-- using /eventtrace to see what events fire in different situations.