Macro auto ataque


Show Show

Recommended Posts

Sempre vejo o pessoal reclamando dos summons do global que "bugam" o bot, dentre algumas outras coisas. Fiz algumas modificações no macro de auto ataque que já existia:

1 - Opção de Follow no target.

2 - Pausa o cavebot enquanto estiver atacando e retoma quando não mais estiver.

3 - Controle do intervalo de distância dos monstros, ignorando aqueles fora desse intervalo.

4 - Configuração de duas magias de ataque de acordo com a porcentagem de mana do personagem.

Qualquer problema ou dúvida pode mandar mensagem ingame para: Heeey, Jhon Snowy, Drurian ou kalastaja. De preferência fala pelo discord (dimerism#5429) que caso esteja afk quando ver respondo. Lembrando que o código deve ser colocado em Ingame macro editor.

image.png.52e1e5959ae218f3398e824e3bcfb3b8.png

Spoiler

local monsterList = {}
local whitelistMonsters = {"emberwing", "skullfrost", "groovebeast", "thundergiant","pet mercenary","pet archer","pet witchdoctor", "pet mage", "pet blaze" , "pet wolf", "pet dog"}

macro(100, "Atk Closest Target", function()
  if g_game.isAttacking() then
    return
  end
  for _,mob in ipairs(getSpectators(posz())) do
    distancia = getDistanceBetween(pos(), mob:getPosition())
    if mob:isMonster() and not table.find(whitelistMonsters, mob:getName():lower()) and distancia >=distMin and distancia <=distMax then
      table.insert(monsterList, {monster = mob, distance = getDistanceBetween(pos(), mob:getPosition())})
    end
  end
  table.sort(monsterList, function(a,b) return a.distance < b.distance end)
  if not g_game.isAttacking() and monsterList[1] then
    g_game.attack(monsterList[1].monster)
  end
  monsterList = {}
end)


macro(100, "Auto Follow", function()
g_game.setChaseMode(1)
end)


macro(300, "Auto Pause CaveBot", function()
 if g_game.isAttacking() then
  CaveBot.setOn(false)
 else
  CaveBot.setOn(true)
 end
end)


UI.Separator()

UI.Label("Distância para ataque")
distMin = 1
distMax = 8
function Distancia(parent)
    local panelName = "distancia"
    if not parent then
      parent = panel
    end

    local ui = g_ui.createWidget("DualScrollPanel", parent)
    ui:setId(panelName)
    if not storage[panelName] then
      storage[panelName] = {
        min = 1,
        max = 100,
        text = 'exura'
      }
    end

    ui.title:setOn(storage[panelName].enabled)
    ui.title.onClick = function(widget)
      storage[panelName].enabled = not storage[panelName].enabled
      widget:setOn(storage[panelName].enabled)
    end
 
  
    local updateText = function()
      ui.title:setText("distância >= " .. math.floor(storage[panelName].min*8/100)  .. " e <= " .. math.floor(storage[panelName].max*8/100) .. ' sqms')
    end

    local repeatTime
    ui.scroll1.onValueChange = function(scroll, value)
      storage[panelName].min = value
      updateText()
    end
    ui.scroll2.onValueChange = function(scroll, value)
      storage[panelName].max = value
      updateText()
    end
    ui.text.onTextChange = function(widget, text)
      storage[panelName].text = ""
      updateText()
    end


    ui.scroll1:setValue(storage[panelName].min)
    ui.scroll2:setValue(storage[panelName].max)
    
    macro(1000, function()
      
      if storage[panelName].enabled then
        distMin = math.floor(storage[panelName].min*8/100)
        distMax = math.floor(storage[panelName].max*8/100)
      end
    end)
end
Distancia()

UI.Separator()

UI.Label("Magias")

function Magia1(parent)
    local panelName = "magiaUm"
    if not parent then
      parent = panel
    end

    local ui = g_ui.createWidget("DualScrollPanel", parent)
    ui:setId(panelName)
    if not storage[panelName] then
      storage[panelName] = {
        min = 10,
        max = 80,
        text = 'exura'
      }
    end

    ui.title:setOn(storage[panelName].enabled)
    ui.title.onClick = function(widget)
      storage[panelName].enabled = not storage[panelName].enabled
      widget:setOn(storage[panelName].enabled)
    end
 
  
    local updateText = function()
      ui.title:setText("mana >= " .. storage[panelName].min  .. "% e <= " .. storage[panelName].max  .. "%")
    end

    local repeatTime
    ui.scroll1.onValueChange = function(scroll, value)
      storage[panelName].min = value
      updateText()
    end
    ui.scroll2.onValueChange = function(scroll, value)
      storage[panelName].max = value
      updateText()
    end
    ui.text.onTextChange = function(widget, text)
      storage[panelName].text = text
      updateText()
    end


    ui.scroll1:setValue(storage[panelName].min)
    ui.scroll2:setValue(storage[panelName].max)
    ui.text:setText(storage[panelName].text)
    macro(1000, function()
      
      if storage[panelName].enabled and manapercent() >= storage[panelName].min and manapercent() <= storage[panelName].max then
        say(storage[panelName].text)
        
      end
    end)
end
Magia1()


function Magia2(parent)
    local panelName = "MagiaDois"
    if not parent then
      parent = panel
    end

    local ui = g_ui.createWidget("DualScrollPanel", parent)
    ui:setId(panelName)
    if not storage[panelName] then
      storage[panelName] = {
        min = 10,
        max = 80,
        text = 'exura'
      }
    end

    ui.title:setOn(storage[panelName].enabled)
    ui.title.onClick = function(widget)
      storage[panelName].enabled = not storage[panelName].enabled
      widget:setOn(storage[panelName].enabled)
    end
 
  
    local updateText = function()
      ui.title:setText("mana >= " .. storage[panelName].min  .. "% e <= " .. storage[panelName].max  .. "%")
    end

    local repeatTime
    ui.scroll1.onValueChange = function(scroll, value)
      storage[panelName].min = value
      updateText()
    end
    ui.scroll2.onValueChange = function(scroll, value)
      storage[panelName].max = value
      updateText()
    end
    ui.text.onTextChange = function(widget, text)
      storage[panelName].text = text
      updateText()
    end


    ui.scroll1:setValue(storage[panelName].min)
    ui.scroll2:setValue(storage[panelName].max)
    ui.text:setText(storage[panelName].text)
    macro(1000, function()
      
      if storage[panelName].enabled and manapercent() >= storage[panelName].min and manapercent() <= storage[panelName].max then
        say(storage[panelName].text)
        
      end
    end)
end
Magia2()

 

  • Like 7
Link to comment
Share on other sites

11 horas atrás, Coldzera disse:

@Show Show sou meio leigo com essas coisas, então queria tirar uma dúvida. O script "Atk Closest Target" é para que o pet fique próximo ao mestre e que ele não fique saindo da tela dele? Ou não? Não entendi muito bem a funcionalidade.

O personagem vai atacar o monstro mais próximo dele (dentro da faixa especificada) e ignorar pets e summons especiais. A principal funcionalidade é não precisar configurar vários monstros diferentes dentro do Target ou escrever " * " e o bot ficar atacando os pets.

Link to comment
Share on other sites

  • 2 weeks later...

Fiz uma atualização na parte de magias do macro. Antes o personagem soltaria as magias de acordo com a quantia de mana do char, independente de estar atacando algum monstro ou não. Como nem todos upam assim, coloquei um botão a mais "On Target" que quando ativo, condiciona o uso das magias a estar atacando algum monstro.

image.png.970224f8dcef8a498249e4a035045955.png

 

Spoiler

local monsterList = {}
local whitelistMonsters = {"emberwing", "skullfrost", "groovebeast", "thundergiant","pet mercenary","pet archer","pet witchdoctor", "pet mage", "pet blaze" , "pet wolf", "pet dog"}

macro(100, "Atk Closest Target", function()
  if g_game.isAttacking() then
    return
  end
  for _,mob in ipairs(getSpectators(posz())) do
    distancia = getDistanceBetween(pos(), mob:getPosition())
    if mob:isMonster() and not table.find(whitelistMonsters, mob:getName():lower()) and distancia >=distMin and distancia <=distMax then
      table.insert(monsterList, {monster = mob, distance = getDistanceBetween(pos(), mob:getPosition())})
    end
  end
  table.sort(monsterList, function(a,b) return a.distance < b.distance end)
  if not g_game.isAttacking() and monsterList[1] then
    g_game.attack(monsterList[1].monster)
  end
  monsterList = {}
end)


macro(100, "Auto Follow", function()
g_game.setChaseMode(1)
end)


macro(300, "Auto Pause CaveBot", function()
 if g_game.isAttacking() then
  CaveBot.setOn(false)
 else
  CaveBot.setOn(true)
 end
end)


UI.Separator()

UI.Label("Distância para ataque")
distMin = 1
distMax = 8
function Distancia(parent)
    local panelName = "distancia"
    if not parent then
      parent = panel
    end

    local ui = g_ui.createWidget("DualScrollPanel", parent)
    ui:setId(panelName)
    if not storage[panelName] then
      storage[panelName] = {
        min = 1,
        max = 100,
        text = 'exura'
      }
    end

    ui.title:setOn(storage[panelName].enabled)
    ui.title.onClick = function(widget)
      storage[panelName].enabled = not storage[panelName].enabled
      widget:setOn(storage[panelName].enabled)
    end
 
  
    local updateText = function()
      ui.title:setText("distância >= " .. math.floor(storage[panelName].min*8/100)  .. " e <= " .. math.floor(storage[panelName].max*8/100) .. ' sqms')
    end

    local repeatTime
    ui.scroll1.onValueChange = function(scroll, value)
      storage[panelName].min = value
      updateText()
    end
    ui.scroll2.onValueChange = function(scroll, value)
      storage[panelName].max = value
      updateText()
    end
    ui.text.onTextChange = function(widget, text)
      storage[panelName].text = ""
      updateText()
    end


    ui.scroll1:setValue(storage[panelName].min)
    ui.scroll2:setValue(storage[panelName].max)
    
    macro(1000, function()
      
      if storage[panelName].enabled then
        distMin = math.floor(storage[panelName].min*8/100)
        distMax = math.floor(storage[panelName].max*8/100)
      end
    end)
end
Distancia()

UI.Separator()

UI.Label("Magias")


onTarget = macro(10000, "On Target", function()

end)

function Magia1(parent)
    local panelName = "magiaUm"
    if not parent then
      parent = panel
    end

    local ui = g_ui.createWidget("DualScrollPanel", parent)
    ui:setId(panelName)
    if not storage[panelName] then
      storage[panelName] = {
        min = 10,
        max = 80,
        text = 'exura'
      }
    end

    ui.title:setOn(storage[panelName].enabled)
    ui.title.onClick = function(widget)
      storage[panelName].enabled = not storage[panelName].enabled
      widget:setOn(storage[panelName].enabled)
    end
 
  
    local updateText = function()
      ui.title:setText("mana >= " .. storage[panelName].min  .. "% e <= " .. storage[panelName].max  .. "%")
    end

    local repeatTime
    ui.scroll1.onValueChange = function(scroll, value)
      storage[panelName].min = value
      updateText()
    end
    ui.scroll2.onValueChange = function(scroll, value)
      storage[panelName].max = value
      updateText()
    end
    ui.text.onTextChange = function(widget, text)
      storage[panelName].text = text
      updateText()
    end


    ui.scroll1:setValue(storage[panelName].min)
    ui.scroll2:setValue(storage[panelName].max)
    ui.text:setText(storage[panelName].text)
    macro(1000, function()
      
      if storage[panelName].enabled and manapercent() >= storage[panelName].min and manapercent() <= storage[panelName].max then

  if onTarget.isOn() and g_game.isAttacking() then
          say(storage[panelName].text)
  elseif onTarget.isOff() then
    say(storage[panelName].text)
  end
        
      end

    end)
end
Magia1()


function Magia2(parent)
    local panelName = "MagiaDois"
    if not parent then
      parent = panel
    end

    local ui = g_ui.createWidget("DualScrollPanel", parent)
    ui:setId(panelName)
    if not storage[panelName] then
      storage[panelName] = {
        min = 10,
        max = 80,
        text = 'exura'
      }
    end

    ui.title:setOn(storage[panelName].enabled)
    ui.title.onClick = function(widget)
      storage[panelName].enabled = not storage[panelName].enabled
      widget:setOn(storage[panelName].enabled)
    end
 
  
    local updateText = function()
      ui.title:setText("mana >= " .. storage[panelName].min  .. "% e <= " .. storage[panelName].max  .. "%")
    end

    local repeatTime
    ui.scroll1.onValueChange = function(scroll, value)
      storage[panelName].min = value
      updateText()
    end
    ui.scroll2.onValueChange = function(scroll, value)
      storage[panelName].max = value
      updateText()
    end
    ui.text.onTextChange = function(widget, text)
      storage[panelName].text = text
      updateText()
    end


    ui.scroll1:setValue(storage[panelName].min)
    ui.scroll2:setValue(storage[panelName].max)
    ui.text:setText(storage[panelName].text)
    macro(1000, function()
      
      if storage[panelName].enabled and manapercent() >= storage[panelName].min and manapercent() <= storage[panelName].max then
  
  if onTarget.isOn() and g_game.isAttacking() then
          say(storage[panelName].text)
  elseif onTarget.isOff() then
    say(storage[panelName].text)
  end
        
      end
    end)
end
Magia2()

 

 

Link to comment
Share on other sites

1 hora atrás, Cadwallow disse:

manoooooooo que irado esses macros que voce tá fazendo!!! Obrigado pela colaboração. Será que seria viável voce fazer um apanhado de seus macros, por tudo num tpopico (só os links mesmo) pra eu poder mover eles pro Super Listão?

NAOOOOOOOOOOOOOOOOOOOOOO maioria dos macro deles sou eu quer uso n vemmmmm!!!

 

@Show Show Seu trampo ta ficando ttopiiiii rl amassaaaaaaaaa 

Link to comment
Share on other sites

Em 15/08/2021 at 17:24, Cadwallow disse:

manoooooooo que irado esses macros que voce tá fazendo!!! Obrigado pela colaboração. Será que seria viável voce fazer um apanhado de seus macros, por tudo num tpopico (só os links mesmo) pra eu poder mover eles pro Super Listão?

Posso sim. Você tem alguma sugestão de quais macros seriam interessantes pra lista? Qualquer coisa a gente pode trocar uma ideia pelo discord ou ingame mesmo.

Link to comment
Share on other sites

On 8/16/2021 at 9:45 PM, Show Show said:

Posso sim. Você tem alguma sugestão de quais macros seriam interessantes pra lista? Qualquer coisa a gente pode trocar uma ideia pelo discord ou ingame mesmo.

Eu acho que adicionar o maximo que vc puder (sem querer parecer abusado mas ja parecendo kkkk), seria o ideal. Nao se sabe o que uma pessoa pode estar atras.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...