09-20-2021, 08:07 PM
Attack closest monster
This script was developed to be used in Hotkeys. If you want to attack monsters to hunt, together with Cavebot, then use Targeting. Targeting also has options (Targeting -> Targeting Priority) to select the best creature according to your need.
This script was developed to be used in Hotkeys. If you want to attack monsters to hunt, together with Cavebot, then use Targeting. Targeting also has options (Targeting -> Targeting Priority) to select the best creature according to your need.
if connected() then
local best_creature = nil
local creatures = getcreatures('mfs')
for _, creature in ipairs(creatures) do
if best_creature == nil or best_creature.dist > creature.dist then
best_creature = creature
end
end
if best_creature ~= nil then
attack(best_creature.id)
end
end