This is the first addon I'm making from scratch and I really don't see why it doesn't wish to work. Doesn't seem to load at all, and yes it's in the correct location with a toc file and such. Any and all help much appreciated.
TOC
Code:
## Title: Health Alert
## Version: 1.0
## Author: R34P3R
## Interface: 30200
## Notes: An addon that alerts nearby players when health is low.
HealthAlert.lua
HealthAlert.xml
XML
Code:
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ >
<Frame name="HealthAlert">
<Scripts>
<OnLoad>
ha_OnLoad();
</OnLoad>
<OnEvent>
ha_OnUpdate();
</OnEvent>
</Scripts>
</Frame>
</Ui>
LUA
Code:
function ha_OnUpdate()
local HPC = UnitHealth("player") / UnitMaxHealth("player");
if HPC < 0.5 then
SendChatMessage("My health is below 50%!","SAY",nil);
elseif HPC < 0.4 then
SendChatMessage("My health is below 40%!","SAY",nil);
elseif HPC < 0.3 then
SendChatMessage("My health is below 30%!","SAY",nil);
elseif HPC < 0.2 then
SendChatMessage("My health is below 20%! CRITICAL!","YELL",nil);
elseif HPC < 0.1 then
SendChatMessage("My health is below 10%! HEAL ME!","YELL",nil);
end
end
function ha_OnLoad()
DEFAULT_CHAT_FRAME:AddMessage("Health Alert Loaded", 1, 0, 0);
this:RegisterEvent("UNIT_HEALTH");
end