Function the check if three or more people are missing health
Ratayu opened this issue · 2 comments
Before You Begin
- I confirm that I have downloaded the latest version of the addon.
- I am not playing on a private server.
- I checked for an existing, open ticket for this request and was not able to find one.
- I edited the title of this feature request (above) so that it describes the issue I am reporting.
Feature Request
Hey,
I’m playing Resto Shaman and I’m trying to configure Hekili for healing priorities. I have successfully created my own custom priority list, but there's one condition I want to add: casting Chain Heal if at least three people are missing health.
I've tried to research and come up with a script to check if at least three people are missing health. However, I’m not exactly sure how to integrate this condition into Hekili. Specifically, I want to create a condition where this custom function returns true.
Here’s the script I have so far:
-- Count injured friendlies
local countInjuredFriendlies = 0
for i = 1, 40 do
local unit = "raid" .. i
if not UnitExists(unit) then break end
if UnitHealth(unit) < UnitHealthMax(unit) then
countInjuredFriendlies = countInjuredFriendlies + 1
end
if countInjuredFriendlies >= 3 then
break
end
end
-- Return true if at least three people are injured
countInjuredFriendlies >= 3
Is there a way for me to add this condition script so that it can be used within the Hekili addon, such as by placing it in a file or folder within the addon? This would allow me to use a function like Chain Heal
if this function returns true.
Any help or guidance on how to achieve this would be greatly appreciated!
Additional Information
Just wanted to note that I’m not necessarily requesting this to be added as a future within the add-on, but if there is a way that I can always add this as a custom function that I would need to do manually every time I don’t mind doing that
Contact Information
No response
I have been trying to work this. I created a custom lua file with the below
-- CustomFunctions.lua
print("ThisismeCustomFunctions.lua loaded")
function custom_beacon_condition()
print("custom_beacon_condition function called")
local count = 0
for i = 1, GetNumGroupMembers() do
local unit = "raid"..i
print("Checking unit: ", unit)
if UnitExists(unit) and not UnitIsDeadOrGhost(unit) then
print("Unit exists and is not dead or ghost: ", unit)
if UnitHealth(unit) < UnitHealthMax(unit) then
print("Unit health is less than max health: ", unit)
count = count + 1
print("Count incremented: ", count)
if count >= 3 then
print("Condition met: ", count)
return true
end
end
end
end
return false
end
and added the customfunctions.lua call inside of Heklil.toc file and it is loading, keep getting message when reviewing priority list i see the message in addon that 2: attempt to call global 'health_check' (a nil value)
When I do /run print(custom_beacon_condition()) during the game it is reading through and returning true or false, feel like im right there