WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   AddOn Help/Support (https://www.wowinterface.com/forums/forumdisplay.php?f=3)
-   -   Bodyguard Health Frame (https://www.wowinterface.com/forums/showthread.php?t=50548)

sptyi 11-22-14 06:48 AM

Bodyguard Health Frame
 
Before I begin, I have never made an AddOn before. Therefore, I'm not even sure this can be done, let alone how to do it if it is possible. If there is already someone else working on this, that's great, but if not, I'd love to take a stab at it with your help.

So, for those of you still here after that first paragraph, I feel that the bodyguard deserves their own health/aggro frame, especially since there is a 1 hour cooldown to resummon in the case they die. As it stands, the only way to know if they are near death, or pulling aggro is to constantly target them, which is not at all feasible when fighting. Focus frame is also not reliable, obviously.

I have been searching for a way to show an NPC's health in a new frame, but there doesn't seem to have been a need for this before now. Any and all help would be appreciated.

Choonstertwo 11-22-14 10:20 AM

I answered this on the official forums, in case anyone else was curious.

In summary: It's probably possible, but it's not easy because bodyguards don't have a unitID.

sptyi 11-22-14 10:30 AM

Thanks for throwing the link and the help, Choon.

Sharparam 11-27-14 02:30 PM

I might be looking into making a basic addon to track it, it might be decently reliable actually, after advice from #wowuidev.

Maybe a good idea to make it as a library, to open up more possibilities for display addons.

SDPhantom 11-28-14 03:13 AM

I honestly haven't had have any problems using the FocusFrame, but I agree it would be nice for them to have their own UnitID so I can use focus for other targets if needed.

Tonyleila 11-28-14 06:36 AM

Coud anyone make an addon to set the Bodyguard automaticly as Focus if you don't have an other focus? That woud be the best alternative for me.

semlar 11-28-14 07:36 AM

An addon can't automatically set anything as your focus.

Tonyleila 11-28-14 07:46 AM

Quote:

Originally Posted by semlar (Post 301234)
An addon can't automatically set anything as your focus.

Ok then with a macro/keybind?^^

Phanx 11-28-14 07:27 PM

Code:

/stopmacro [@focus,exists]
/focus Unit Name Here

Change "Unit Name Here" to the actual name of the NPC. If there are multiple possibilities, add another /focus line for each possible NPC.

Tonyleila 11-29-14 11:03 AM

Quote:

Originally Posted by Phanx (Post 301282)
Code:

/stopmacro [@focus,exists]
/focus Unit Name Here

Change "Unit Name Here" to the actual name of the NPC. If there are multiple possibilities, add another /focus line for each possible NPC.

Not a good idea farming with others together it will end up not set your own follower as focus but one of your group members :(

EDIT: I see other players followers have a different name

However can anyone tell me if there is an AddOn to alert me when my focus has low HP? Maybe kind of a bigwigs warning when below 50% hp a with blinking screen? Sound dosen't realy help since I hear music while farming.

Phanx 11-29-14 10:56 PM

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/

Tonyleila 11-30-14 01:00 PM

Thanks again Phanx - as I told you via PM the code is not working, even tryed to disable all AddOns.
Maybe someone else can help to fix it? If possible even add a BigWigs alert to it with the screen light up thing?

I added names for all Bodyguards in all languages to the file:


BodyguardFocusAlert.toc
Code:

## Interface: 60000
## Author: Phanx
## Version: 1.0
## Title: BodyguardFocusAlert
## Notes: Alerts when focused Bodyguard gets low HP

BodyguardFocusAlert.lua
Code:

local alertFor = {
    ["Krallenpriester Ishaal"] = true,  -- Horde/Alliance
    ["Talonpriest Ishaal"] = true,
    ["Sacerdote de la garra Ishaal"] = true,
    ["Prêtre de la serre Ishaal"] = true,
    ["Sacerdote dell'Artiglio Ishaal"] = true,
    ["Sacerdote da Garra Ishaal"] = true,
    ["Жрец Когтя Ишааль"] = true,
       
    ["Tormmok"] = true, -- Horde/Alliance
    ["Тормок"] = true,
       
    ["Leorajh"] = true,  -- Horde/Alliance
    ["Леорадж"] = true,

    ["Aeda Morgenglanz"] = true, -- Horde
    ["Aeda Brightdawn"] = true,
    ["Aeda Alba Brillante"] = true,       
    ["Aeda Brillaube"] = true,               
    ["Aeda Albaluce"] = true,
    ["Aeda Brilhalvo"] = true,
    ["Аеда Ясная Заря"] = true,
    ["Beschützerin Illona"] = true, -- Alliance
    ["Defender Illona"] = true,
    ["Defensora Illona"] = true,
    ["Défenseur Illona"] = true,       
    ["Difensore Illona"] = true,
    ["Defensora Illona"] = true,
    ["Защитница Иллона"] = true,

    ["Vivianne"] = true, -- Horde
    ["Вивианна"] = true,
    ["Delvar Eisenfaust"] = true, -- Alliance
    ["Delvar Ironfist"] = true,       
    ["Delvar Puño de Hierro"] = true,
    ["Delvar Poing-de-Fer"] = true,
    ["Delvar Pugnoferreo"] = true,       
    ["Delvar Punho de Ferro"] = true,
    ["Делвар Железный Кулак"] = 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.6 then
          UIErrorsFrame:AddMessage(format("%s @ %d%% HP!", name, percent * 100)
    end
end)


Phanx 11-30-14 02:12 PM

Well, assuming you did not make an error when copying and pasting, the problem is simple -- you forgot to list the Lua file in the TOC file, so it's not getting loaded at all. ;)

Tonyleila 11-30-14 03:20 PM

Quote:

Originally Posted by Phanx (Post 301435)
Well, assuming you did not make an error when copying and pasting, the problem is simple -- you forgot to list the Lua file in the TOC file, so it's not getting loaded at all. ;)

Indeed this was a copy past fail - in my version it looks like this and its still not working, is there also something wrong with it?

Code:

## Interface: 60000
## Author: Phanx
## Version: 1.0
## Title: BodyguardFocusAlert
## Notes: Alerts when focused Bodyguard gets low HP

BodyguardFocusAlert.lua

Edit got this error:
Quote:

14x BodyguardFocusAlert\BodyguardFocusAlert-1.0.lua:50: ')' expected (to close '(' at line 49) near 'end'
Locals:

JDoubleU00 11-30-14 10:02 PM

Don't you need another parenthesis on this line?

f:SetScript("OnEvent", function(self, event, unit)

sirann 11-30-14 11:51 PM

No, the parenthesis is closed as is the function with end)

Tonyleila 12-01-14 12:07 AM

Got it to work now!

However it dosen't have any use for me yet since its just a little white text :( Realy need a BIG warning and Screen flashing or something like BigWigs.
http://i.imgur.com/H7YepYd.jpg

Phanx 12-01-14 01:14 AM

Yeah, I don't raid anymore so I don't have BigWigs installed and didn't feel like downloading it and searching through 10000 lines of code to find how to trigger a custom alert. You'd just need to change the UIErrorsFrame:AddMessage line to do whatever it is you wanted to do, though.

Tonyleila 12-01-14 02:54 PM

Thanks again Phanx have uploaded it here now, with a sound and Raidwarning:
http://www.wowinterface.com/download...ocusAlert.html

Tonyleila 12-05-14 06:03 AM

So i'm not shure if i shoud start a new topic on this:
Anyone has an idea of how an addon coud work that reminds you of taking your bodyguard with you when you talk to the flight master in your garrison? Its not only me with that problem i also heard some guildmates talking about this. pull in a new bodyguard into my building then taking the farest flghtpath that he has just to find out that i forgot to pick up the bodyguard from his place in front of the.building.

Maybe ist possible to check if you have talked to the bodyguard after you have put him into the building.


All times are GMT -6. The time now is 11:13 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI