Basic code to spam the UIErrorsFrame with "Follower Name @ 42% HP!" while your follow's health is under 50%.
Code:
local alertFor = {
["Follower Name A"] = true,
["Follower Name B"] = true,
}
local f = CreateFrame("Frame")
f:RegisterUnitEvent("UNIT_HEALTH", "focus")
f:SetScript("OnEvent", function(self, event, unit)
local name = UnitName(unit)
if not alertFor[name] then return end
local hp, hpmax = UnitHealth(unit), UnitHealthMax(unit)
local percent = hp / hpmax
if percent < 0.5 then
UIErrorsFrame:AddMessage(format("%s @ %d%% HP!", name, percent * 100)
end
end)
If you need help turning the above code into an addon, copy and paste it into this page:
http://addon.bool.no/