Haven't tested it but should work.
lua code:local manaPotion = "mana potion" -- name or id of mana potion
local upToMana = 70 -- percentagle amount
local waitUntilManaIsNotRefiled = true -- if you want to wait when refilling mana (if you are ek use it)
local monstersToRefilmana = 2 -- amount of monster to start mana refiller
--[[ DO NOT EDIT ANYTHING BELOW THIS LINE ]]--
function monstersInRange()
local count = 0
for name, obj in Creature.iMonsters() do
count = count + 1
end
return count
end
Module.New("mana-refiller", function()
if (monstersInRange() <= monstersToRefilmana and math.abs(Self.Mana()/(Self.MaxMana()*0.01)) < upToMana) then
Self.UseItemWithMe(Item.GetItemIDFromDualInput(manaPotion))
if (waitUntilManaIsNotRefiled) then
Walker.Delay(500)
end
end
end)