Thread Tools Display Modes
11-22-14, 06:48 AM   #1
sptyi
A Murloc Raider
Join Date: Nov 2014
Posts: 6
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.
  Reply With Quote
11-22-14, 10:20 AM   #2
Choonstertwo
A Chromatic Dragonspawn
 
Choonstertwo's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2011
Posts: 194
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.
  Reply With Quote
11-22-14, 10:30 AM   #3
sptyi
A Murloc Raider
Join Date: Nov 2014
Posts: 6
Thanks for throwing the link and the help, Choon.
  Reply With Quote
11-27-14, 02:30 PM   #4
Sharparam
A Flamescale Wyrmkin
 
Sharparam's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2011
Posts: 102
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.
  Reply With Quote
11-28-14, 03:13 AM   #5
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,322
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.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote
11-28-14, 06:36 AM   #6
Tonyleila
A Molten Giant
 
Tonyleila's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 758
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.
__________________
Author of: LeilaUI and Aurora: Missing Textures
__________________
  Reply With Quote
11-28-14, 07:36 AM   #7
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
An addon can't automatically set anything as your focus.
  Reply With Quote
11-28-14, 07:46 AM   #8
Tonyleila
A Molten Giant
 
Tonyleila's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 758
Originally Posted by semlar View Post
An addon can't automatically set anything as your focus.
Ok then with a macro/keybind?^^
__________________
Author of: LeilaUI and Aurora: Missing Textures
__________________
  Reply With Quote
11-28-14, 07:27 PM   #9
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
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.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
11-29-14, 11:03 AM   #10
Tonyleila
A Molten Giant
 
Tonyleila's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 758
Originally Posted by Phanx View Post
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.
__________________
Author of: LeilaUI and Aurora: Missing Textures
__________________

Last edited by Tonyleila : 11-29-14 at 01:41 PM.
  Reply With Quote
11-29-14, 10:56 PM   #11
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
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/
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
11-30-14, 01:00 PM   #12
Tonyleila
A Molten Giant
 
Tonyleila's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 758
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)
__________________
Author of: LeilaUI and Aurora: Missing Textures
__________________
  Reply With Quote
11-30-14, 02:12 PM   #13
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
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.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
11-30-14, 03:20 PM   #14
Tonyleila
A Molten Giant
 
Tonyleila's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 758
Originally Posted by Phanx View Post
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:
14x BodyguardFocusAlert\BodyguardFocusAlert-1.0.lua:50: ')' expected (to close '(' at line 49) near 'end'
Locals:
__________________
Author of: LeilaUI and Aurora: Missing Textures
__________________

Last edited by Tonyleila : 11-30-14 at 09:28 PM.
  Reply With Quote
11-30-14, 10:02 PM   #15
JDoubleU00
A Firelord
 
JDoubleU00's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 463
Don't you need another parenthesis on this line?

f:SetScript("OnEvent", function(self, event, unit)
  Reply With Quote
11-30-14, 11:51 PM   #16
sirann
A Flamescale Wyrmkin
Join Date: Mar 2007
Posts: 142
No, the parenthesis is closed as is the function with end)
  Reply With Quote
12-01-14, 12:07 AM   #17
Tonyleila
A Molten Giant
 
Tonyleila's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 758
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
__________________
Author of: LeilaUI and Aurora: Missing Textures
__________________
  Reply With Quote
12-01-14, 01:14 AM   #18
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
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.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
12-01-14, 02:54 PM   #19
Tonyleila
A Molten Giant
 
Tonyleila's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 758
Thanks again Phanx have uploaded it here now, with a sound and Raidwarning:
http://www.wowinterface.com/download...ocusAlert.html
__________________
Author of: LeilaUI and Aurora: Missing Textures
__________________
  Reply With Quote
12-05-14, 06:03 AM   #20
Tonyleila
A Molten Giant
 
Tonyleila's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 758
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.
__________________
Author of: LeilaUI and Aurora: Missing Textures
__________________
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Bodyguard Health Frame

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off