1. Hi this is one of my first addons that i am probebly ever going to write and i still cant figure out what the code is to announce when a character is at a certain health % and display other data such CD

    Hi this is one of my first addons that i am probebly ever going to write and i still cant figure out what the code is to announce when a character is at a certain health % and display other data such CD

    Well I can't give you a one-size-fits-all solution.  If you want to do something when the character is at a certain percentage health, try something like the following, which prints a warning when the player is below 75% health:

    if not MyTestFrame then

      CreateFrame("Frame", "MyTestFrame")

    end



    local frame = MyTestFrame

    frame:UnregisterAllEvents()

    frame:RegisterEvent("UNIT_HEALTH")

    frame:SetScript("OnEvent", function(self, event, arg1, ...)

      if event == "UNIT_HEALTH" and arg1 == "player" then

        local max = UnitHealthMax("player")

        local current = UnitHealth("player")

        local perc = current / max * 100

        if perc <= 75 then

          print("Player is below 75% health!")

        end

      end

    end)