maround is being used to count only monsters on screen.
Anyway, i have applied some changes to create 2 scripts:
this script will only count monsters 5 sqms away from you.
local Monsters = { 'Frost Dragon', 'Dragon Lord' }
if connected() then
local monstersCount = maround(5, table.unpack(Monsters))
if monstersCount >= 5 then
setsettings('Cavebot/Enabled', false)
if iswalking() then
stop()
wait(100,300)
end
setsettings('Targeting/Enabled', true)
KILLING_MONSTERS = true
elseif KILLING_MONSTERS and monstersCount < 2 then
KILLING_MONSTERS = false
setsettings('Targeting/Enabled', false)
setsettings('Cavebot/Enabled', true)
end
end
Tihs script will check if the monster is reachable and only counts if monster's X distance is lower or equal than value or monster's Y distance is lower or equal than value. Because you can see more sqms on horizontal than vertical.
local Monsters = { 'Frost Dragon', 'Dragon Lord' }
local MAX_X_DIST = 6
local MAX_Y_DIST = 4
if connected() then
table.lower(Monsters)
local monstersCount = 0
local playerX = posx()
local playerY = posy()
local monsters = getcreatures('mfs')
for _, monster in ipairs(monsters) do
if monster.visible and monster.isreachable and (math.abs(monster.posx - playerX) <= MAX_X_DIST or math.abs(monster.posy - playerY) <= MAX_Y_DIST) and table.find(Monsters, monster.name:lower()) ~= nil then
monstersCount = monstersCount + 1
end
end
if monstersCount >= 5 then
setsettings('Cavebot/Enabled', false)
if iswalking() then
stop()
wait(100,300)
end
setsettings('Targeting/Enabled', true)
KILLING_MONSTERS = true
elseif KILLING_MONSTERS and monstersCount < 2 then
KILLING_MONSTERS = false
setsettings('Targeting/Enabled', false)
setsettings('Cavebot/Enabled', true)
end
end