Originally Posted by
bu_ba_911
targethp set to 100 was pretty much saying this. The ghost player we compare against has 100% health, and if you gave less health than that you are now the target player :-) . So valma you were having issues with it healing people when it was set to 100?
Also in regards to the deep corruption, mine was a lot ,more in depth, but I think the spellid I was given was wrong lol. Valma have you looked my newest update over yet?
I put my stack checker for DC in SafeTarget function
I had problems with it healing myself,so I modded your code a bit,and implied a bit better logic(as I think,but you know my point of view is not obsolete LOL
).Here what I got:
Code:
<Ability><Name>AT Smart Low HP NMO</Name><Default>false</Default><SpellID>0</SpellID><Actions></Actions>
<Lua>
if not healinit then
function CalculateHP(t)
local incomingheal = 0
if UnitGetIncomingHeals(t) then incomingheal = UnitGetIncomingHeals(t) end
return 100 * ( UnitHealth(t) + incomingheal ) / UnitHealthMax(t)
end
function SafeTarget(t)
if IsSpellInRange(tostring(GetSpellInfo(635)),t) == 1
and UnitExists(t)
and UnitIsCharmed(t) == nil
and UnitIsDeadOrGhost(t) == nil
and UnitIsFriend(&quot;player&quot;,t)
and PQR_IsOutOfSight(t) == false
then
if UnitDebuffID(t, 108220) and select(4, UnitDebuffID(t, 108220) < 3 then
return true
elseif UnitDebuffID(t, 108220) == nil
return true
end
end
end
healinit = true
end
if SafeTarget(&quot;target&quot;) then
PQR_CustomTarget = &quot;target&quot;
PQR_CustomTargetHP = CalculateHP(&quot;target&quot;)
else
lowhpmembers = 0
PQR_CustomTarget = &quot;player&quot;
PQR_CustomTargetHP = CalculateHP(&quot;player&quot;)
local group = &quot;party&quot;
local members = GetNumPartyMembers()
local targethp = CalculateHP(&quot;player&quot;) + 20
if GetNumRaidMembers() &gt; 0 then group = &quot;raid&quot; members = GetNumRaidMembers() end
for i = 1, members, 1 do
local member = group..tostring(i)
local memberhp = CalculateHP(member)
if SafeTarget(member) then
if UnitGroupRolesAssigned(member) == &quot;TANK&quot; and UnitBuffID(member, 53563) == nil then memberhp = memberhp - 1 else memberhp = memberhp + 3 end
if UnitThreatSituation(member) == 3 then memberhp = memberhp - 3 end
if memberhp &lt; 88 then lowhpmembers = lowhpmembers +1 end
if memberhp &lt; targethp then
PQR_CustomTarget = member
targethp = memberhp
PQR_CustomTargetHP = 100 * UnitHealth(PQR_CustomTarget) / UnitHealthMax(PQR_CustomTarget)
end
end
end
end
</Lua>
<RecastDelay>0</RecastDelay><Target>Target</Target><CancelChannel>False</CancelChannel><LuaBefore></LuaBefore><LuaAfter></LuaAfter></Ability>
As you can see the code is more simplier then it was before while it do exactly the same. :/
local targethp = CalculateHP(&quot;player&quot
+ 20 This made for handle passive self healing ability, ie if pally has 80% hp it means he dont need/deserve(
) heals and will be healed passivelly.