Everyone who has never used our Bots before, can test each one for 2 days without any limitation.
The trial is given automatically when you login on the Bot, but in some cases it wouldn't work (security reasons).
If this happens, send me a private message and i will be checking the failed trials manually and adding it for those who didn't get it.
We are looking for resellers who may accept payment methods different from ours, including classictibia's cash, realesta's cash, mastercores' cash, etc. Interested? Click here at anytime.



Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Targeting on if X monster on screen
#1
hi

I need a script which one is gonna work +/- like this:

Monsters: Frost Dragon, Dragon Lord
If amount of monsters on visible screen > 5 then "stand" and wait (600)
Targetting on
then
If amount of monsters on visible screen < 2 then targetting off and go next waypoint
Reply

#2
local Monsters = { 'Frost Dragon', 'Dragon Lord' }

local monstersCount = maround(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
Reply

#3
@Arkilys

Can i please you to make little changes? Because in general script works fine.
But from time to time i have situations, that bot detected monster (in my opinion) 1 sqm over screen and then its not starting cavebot, beacuse he see monster.
I tried set up attack range to max sqm, but it doesnt help.

So i think option monsters on "visible screen", its on the best.
Reply

#4
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
Reply



Forum Jump:



Forum software by © MyBB Theme © iAndrew 2016