init start
local friends = {
{name = 'Friend1', hppc = 90},
{name = 'Friend2', hppc = 30},
-- you can delete or add friends by copying lines
}
local selfhppc = 90 -- % of your HP to mas res self (if enough people are in range), if your HP% is below will not sio friends.
local mininrange = 2 -- Atleast how many peope has to be in range of mas res to use it (including you only if your HP% is below selfhppc)
-- If theres no action to take it will run SPELL HEALER.
init end
auto(20,50)
local inrange = 0
local tosioname = nil
if $hppc <= selfhppc then
inrange = inrange + 1
end
foreach creature m 'pt' do
for k, v in ipairs(friends) do
if m.name == v.name and m.hppc <= v.hppc then
if tosioname == nil then
tosioname = m.name
end
if m.dist <=3 then
inrange = inrange + 1
end
end
end
end
if inrange >= mininrange then
if getsetting('SpellHealer/Enabled') == 'yes' then
setsetting('SpellHealer/Enabled', 'no')
end
if cancastspell('Mass Healing') then
cast('exura gran mas res')
end
return
end
if tosioname ~= nil and $hppc >= selfhppc then
if getsetting('SpellHealer/Enabled') == 'yes' then
setsetting('SpellHealer/Enabled', 'no')
end
if cancastspell('Heal Friend') then
cast('exura sio "' .. tosioname)
end
return
end
if getsetting('SpellHealer/Enabled') == 'no' then
setsetting('SpellHealer/Enabled', 'yes')
end
edit1: fixed bug
Post feedback please also feel free to improve! It lacks checking if enough mana to cast spells. Also could be improved to sio player with least hp.
Found out LucasLib has massheal and sio functions, but anyway this might be usefull.