AUTO ATAQUE


Ex-Membro da Equipe

Recommended Posts

ve se vai fucionar

auto_attack = cycleEvent(function()
	if not g_game.isOnline() then return end
	if g_game.isAttacking() then return end
	local player = g_game.getLocalPlayer()
	local spec = g_map.getSpectators(player:getPosition())
	
	for k,monster in pairs(spec) do
		if monster:isMonster() and not monster:isPlayer() and not monster:isNpc() then
			g_game.attack(monster)
			break
		end
	end
end, 400)

edit1: pra parar o script vc digita no terminal removeEvent(auto_attack)

Link to comment
Share on other sites

5 hours ago, Gugu - Karin Uzumaki said:

ve se vai fucionar


auto_attack = cycleEvent(function()
	if not g_game.isOnline() then return end
	if g_game.isAttacking() then return end
	local player = g_game.getLocalPlayer()
	local spec = g_map.getSpectators(player:getPosition())
	
	for k,monster in pairs(spec) do
		if monster:isMonster() and not monster:isPlayer() and not monster:isNpc() then
			g_game.attack(monster)
			break
		end
	end
end, 400)

edit1: pra parar o script vc digita no terminal removeEvent(auto_attack)

Funcionou como sempre GU, você é muito talentoso, Obrigado novamente pela ajuda !

  • Like 1
Link to comment
Share on other sites

  • 1 year later...
23 hours ago, Patata said:

Desculpa reviver esse tópico mais esse script consegue incluir a função para n atacar os pets ?

Testa assim...

auto_attack = cycleEvent(function()
  ignore = {'Pet Archer', 'Pet Blaze', 'Pet Dog', 'Pet Mage', 'Pet Mercenary', 'Pet Witchdoctor', 'Pet Wolf'}
  if not g_game.isOnline() then 
    return 
  end
  
  if g_game.isAttacking() then 
    return 
  end

  local player = g_game.getLocalPlayer()
  local spec = g_map.getSpectators(player:getPosition())

  function isInArray(tbl, value)
    for k, v in ipairs(tbl) do
      if v == value then
        return k
      end
    end
    return false
  end

  for k,monster in pairs(spec) do
    if not isInArray(ignore, monster:getName()) then
      if monster:isMonster() and not monster:isPlayer() and not monster:isNpc() then
        g_game.attack(monster)
        break
      end
    end
  end
end, 400)

 

Link to comment
Share on other sites

  • 2 weeks later...

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...