Minion Beta! - Help us test our new AddOn updater. Get it now!
Download
(1 Kb)
Download
Updated: 11-30-11 09:35 AM
Pictures
File Info
Updated:11-30-11 09:35 AM
Created:12-11-10 06:19 PM
Downloads:2,232
Favorites:9
MD5:

LowHP

Version: 4.3.0-r7
by: StoffeTiX [More]

Plays a sound and displays an onscreenmessage upon reaching < 30% health.


NOTE
From now on this addon will be updated on Cruse only so please click the link below to get there
http://www.curse.com/addons/wow/low-hp



To Change what percentage you get the warning on, just edit line 6 in the LowHP.lua file

30%

Code:
if hp > 0.3 then return end
to for example 35%
Code:
if hp > 0.35 then return end
or to 40%
Code:
if hp > 0.4 then return end

Click here to lend your support!

4.3.0-r7
* Updated for patch 4.3
* New version system applyed

v1.5.40200:
* Updated for patch 4.2

v1.4.40000:
* Fixed code error.

v1.3.40000:
* Complete rewrite.

v1.2.40000:
* Documentation updates.

v1.1.40000
* Fixed mispelling in the code. =P

v1.0.40000
* Initial release
Optional Files (0)


Archived Files (5)
File Name
Version
Size
Author
Date
1.5.40200
1kB
StoffeTiX
07-28-11 03:27 PM
1.4.40000
1kB
StoffeTiX
03-27-11 04:54 AM
1.3.40000
1kB
StoffeTiX
03-20-11 08:59 AM
1.2.40000
1kB
StoffeTiX
03-17-11 02:23 PM
1.1.40000
1kB
StoffeTiX
12-12-10 12:56 PM


Post A Reply Comment Options
Unread 03-27-12, 10:30 AM  
Siannus
A Defias Bandit
AddOn Author - Click to view AddOns

Forum posts: 3
File comments: 77
Uploads: 2
I know, your not supporting this on WoWI anymore, why Curse? Curse is crap and crashes my IE8.

Anyhow, your discription is this:

Plays a sound and displays an onscreenmessage upon reaching < 30% health.

Explain to me where in your code does it play a sound?
Siannus is offline Report comment to moderator  
Reply With Quote
Unread 03-27-11, 06:01 AM  
StoffeTiX
A Kobold Labourer
AddOn Author - Click to view AddOns

Forum posts: 0
File comments: 23
Uploads: 5
Originally posted by Spike`
hmm



:\

k fixed by doing

local f = CreateFrame("MessageFrame", "LowHPBox", UIParent)

removing the "" on UIParent
This is now implemented in the addon, thx for the heads-up
StoffeTiX is offline Report comment to moderator  
Reply With Quote
Unread 03-21-11, 11:34 AM  
Spike`
A Defias Bandit
AddOn Author - Click to view AddOns

Forum posts: 3
File comments: 35
Uploads: 1
hmm

Message: Interface\AddOns\LowHP\LowHP.lua:1: Usage: CreateFrame("frameType" [, "name"] [, parent] [, "template"] [, id])
:\

k fixed by doing

local f = CreateFrame("MessageFrame", "LowHPBox", UIParent)

removing the "" on UIParent
Last edited by Spike` : 03-21-11 at 11:47 AM.
Spike` is offline Report comment to moderator  
Reply With Quote
Unread 03-20-11, 03:50 PM  
StoffeTiX
A Kobold Labourer
AddOn Author - Click to view AddOns

Forum posts: 0
File comments: 23
Uploads: 5
zynix
wow thx, i will implement this in the next release
StoffeTiX is offline Report comment to moderator  
Reply With Quote
Unread 03-20-11, 02:03 PM  
zynix
A Cliff Giant
 
zynix's Avatar
AddOn Author - Click to view AddOns

Forum posts: 70
File comments: 74
Uploads: 2
You could also make a variable at the top like:
lua Code:
  1. local LowHPTreshold = 30 -- default is 30%
  2. local f = CreateFrame("MessageFrame", "LowHPBox", "UIParent")
  3. f:SetPoint("CENTER")
  4. f:SetSize(512, 60)
  5. f:SetFontObject(NumberFontNormalHuge)
  6. f:SetJustifyH("CENTER")
  7.  
  8. local last = 0
  9. f:RegisterEvent("UNIT_HEALTH")
  10. f:SetScript("OnEvent", function(self, event, unit)
  11.     if unit ~= "player" then return end
  12.  
  13.     local hp = UnitHealth(unit) / UnitHealthMax(unit)
  14.     if hp > LowHPTreshold/100 then return end
  15.  
  16.     local now = GetTime()
  17.     if now - last < 10 then return end
  18.  
  19.     self:AddMessage("Low HEALTH", 1, 0, 0, 1, 3)
  20.     last = now
  21. end)

And if you want to be able to change it ingame:

lua Code:
  1. local LowHPTreshold = 30 -- default is 30%
  2. local f = CreateFrame("MessageFrame", "LowHPBox", "UIParent")
  3. f:SetPoint("CENTER")
  4. f:SetSize(512, 60)
  5. f:SetFontObject(NumberFontNormalHuge)
  6. f:SetJustifyH("CENTER")
  7.  
  8. local last = 0
  9. f:RegisterEvent("UNIT_HEALTH")
  10. f:SetScript("OnEvent", function(self, event, unit)
  11.     if unit ~= "player" then return end
  12.  
  13.     local hp = UnitHealth(unit) / UnitHealthMax(unit)
  14.     if hp > LowHPTreshold/100 then return end
  15.  
  16.     local now = GetTime()
  17.     if now - last < 10 then return end
  18.  
  19.     self:AddMessage("Low HEALTH", 1, 0, 0, 1, 3)
  20.     last = now
  21. end)
  22.  
  23. SLASH_SETHPTRESHOLD1 = "/lowhp "
  24. SlashCmdList["SETHPTRESHOLD"] = function(msg)
  25.     if msg < 0  and msg > 100 then
  26.         LowHPTreshold = msg
  27.     elseif msg == 0 or msg == 100 then
  28.         print("LowHP: Treshold must be larger than 0 and smaller than 100!")
  29.     end
  30. end

And then add this:
Code:
## SavedVariables: LowHPTreshold
to the .toc file
Last edited by zynix : 03-20-11 at 02:10 PM.
zynix is offline Report comment to moderator  
Reply With Quote
Unread 03-20-11, 08:53 AM  
StoffeTiX
A Kobold Labourer
AddOn Author - Click to view AddOns

Forum posts: 0
File comments: 23
Uploads: 5
Originally posted by Phanx
You can replace your XML and Lua files with a single Lua file containing this:...
Thx a lot, i'm not playing anymore so this helps a lot.
StoffeTiX is offline Report comment to moderator  
Reply With Quote
Unread 03-18-11, 03:17 PM  
Phanx
A Pyroguard Emberseer
 
Phanx's Avatar
AddOn Author - Click to view AddOns

Forum posts: 4742
File comments: 2137
Uploads: 43
You can replace your XML and Lua files with a single Lua file containing this:
Code:
local f = CreateFrame("MessageFrame", "LowHPBox", "UIParent")
f:SetPoint("CENTER")
f:SetSize(512, 60)
f:SetFontObject(NumberFontNormalHuge)
f:SetJustifyH("CENTER")

local last = 0
f:RegisterEvent("UNIT_HEALTH")
f:SetScript("OnEvent", function(self, event, unit)
	if unit ~= "player" then return end

	local hp = UnitHealth(unit) / UnitHealthMax(unit)
	if hp > 0.3 then return end

	local now = GetTime()
	if now - last < 10 then return end

	self:AddMessage("Low HEALTH", 1, 0, 0, 1, 3)
	last = now
end)
Not tested in-game but should be basically sound. Adjust as needed/desired. Change 10 to the minimum time you want to wait between warnings to avoid spamming for tanks or other situations where health is fluctuating heavily.
Phanx is offline Report comment to moderator  
Reply With Quote
Unread 03-18-11, 03:01 PM  
StoffeTiX
A Kobold Labourer
AddOn Author - Click to view AddOns

Forum posts: 0
File comments: 23
Uploads: 5
Originally posted by Sniffles
Use OnEvent instead of OnUpdate. OnEvent use less cpu
Thx for the tip
StoffeTiX is offline Report comment to moderator  
Reply With Quote
Unread 03-17-11, 02:46 PM  
Sniffles
A Black Drake
 
Sniffles's Avatar
AddOn Author - Click to view AddOns

Forum posts: 86
File comments: 76
Uploads: 16
Use OnEvent instead of OnUpdate. OnEvent use less cpu
Sniffles is offline Report comment to moderator  
Reply With Quote
Unread 03-17-11, 02:04 PM  
StoffeTiX
A Kobold Labourer
AddOn Author - Click to view AddOns

Forum posts: 0
File comments: 23
Uploads: 5
Originally posted by Keyzer
This addon is constantly using 2% cpu.
I'm looking into reduce the cpu usage, thx for your report.
StoffeTiX is offline Report comment to moderator  
Reply With Quote
Unread 03-03-11, 10:39 AM  
Keyzer
A Murloc Raider

Forum posts: 6
File comments: 15
Uploads: 0
This addon is constantly using 2% cpu.
Keyzer is offline Report comment to moderator  
Reply With Quote
Unread 12-12-10, 12:42 PM  
StoffeTiX
A Kobold Labourer
AddOn Author - Click to view AddOns

Forum posts: 0
File comments: 23
Uploads: 5
I have added an explenation in the inforamtion here on wowinterface.

Thx for your feedback
StoffeTiX is offline Report comment to moderator  
Reply With Quote
Unread 12-11-10, 10:44 PM  
smanzo
A Defias Bandit

Forum posts: 3
File comments: 28
Uploads: 0
It's a decimal notation in the first few lines of the LUA...
smanzo is offline Report comment to moderator  
Reply With Quote
Unread 12-11-10, 09:44 PM  
TheRealArkayn
A Deviate Faerie Dragon
 
TheRealArkayn's Avatar
AddOn Author - Click to view AddOns

Forum posts: 15
File comments: 15
Uploads: 2
Config?

You might consider mentioning which line(s) need to be edited in order for someone to change the 30% to whatever value they want.
TheRealArkayn is offline Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump:

Support AddOn Development!

You have just downloaded by the author . If you like this AddOn why not consider supporting the author? This author has set up a donation account. Donations ensure that authors can continue to develop useful tools for everyone.