Making a simple addon need event help
I'm making a simple addon to check my pets health and see if it's below 80% but i'm stuck on what event i should use to check it's health
i'm very newby to lua and have only made one other addon i get the jist of it but choosing what events i should use is still a bit difficult |
UNIT_HEALTH with arg1 being "pet"
http://wowprogramming.com/docs/events/UNIT_HEALTH And then use GetUnitHealth("pet") http://wowprogramming.com/docs/api/UnitHealth This is of course you are talking about hunter pets. If you are talking about the critter pets these are listed elsewhere on the same site under pet battle. |
UnitHealth, not GetUnitHealth. :)
Also a good idea is to check if the unitID returned by UNIT_HEALTH is that of the unit you're interested in before you do anything else. |
Code:
local eventframe = CreateFrame("Frame") |
Quote:
|
Ok, I went over everything you guys posted and it really helped alot!
Thanks Dridzt your code made it easier for me to understand what i needed to change and now everything works fine =D and thanks everyone else all very helpful =) |
All times are GMT -6. The time now is 11:44 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI