Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/03/21 in all areas

  1. Not ideal as you ask, but made for my needs. if not g_game.isOnline() then return end local function wave5x3() local MonstersInRangeN = 0 local MonstersInRangeE = 0 local MonstersInRangeS = 0 local MonstersInRangeW = 0 local MonstersInActualRange = 0 local direction = g_game.getLocalPlayer():getDirection() for _, creature in pairs(g_game.getCreatures()) do local playerPos = g_game.getLocalPlayer():getPosition() local creaturePos = creature:getPosition() local offsetX = playerPos.x - creaturePos.x local offsetY = playerPos.y - creaturePos.y if creature == nil then creature = playerPos end -- West if creature:isMonster() and creaturePos:isInRange(playerPos, 5, 5) and offsetX >= 1 and offsetX <= 5 and offsetY <= 1 and offsetY >= -1 then MonstersInRangeW = MonstersInRangeW + 1 end -- East if creature:isMonster() and creaturePos:isInRange(playerPos, 5, 5) and offsetX >= -5 and offsetX <= -1 and offsetY <= 1 and offsetY >= -1 then MonstersInRangeE = MonstersInRangeE + 1 end -- North if creature:isMonster() and creaturePos:isInRange(playerPos, 5, 5) and offsetY >= 1 and offsetY <= 5 and offsetX <= 1 and offsetX >= -1 then MonstersInRangeN = MonstersInRangeN + 1 end -- Sauth if creature:isMonster() and creaturePos:isInRange(playerPos, 5, 5) and offsetY >= -5 and offsetY <= -1 and offsetX <= 1 and offsetX >= -1 then MonstersInRangeS = MonstersInRangeS + 1 end end local highest = 0 local nums = {MonstersInRangeN, MonstersInRangeE, MonstersInRangeS, MonstersInRangeW} local bestdirection = direction for i,v in pairs(nums)do if v > highest then highest = v end end if highest == MonstersInRangeN and MonstersInRangeN > MonstersInRangeE and MonstersInRangeN > MonstersInRangeS and MonstersInRangeN > MonstersInRangeW then bestdirection = 0 end if highest == MonstersInRangeE and MonstersInRangeE > MonstersInRangeN and MonstersInRangeE > MonstersInRangeS and MonstersInRangeE > MonstersInRangeW then bestdirection = 1 end if highest == MonstersInRangeS and MonstersInRangeS > MonstersInRangeE and MonstersInRangeS > MonstersInRangeN and MonstersInRangeS > MonstersInRangeW then bestdirection = 2 end if highest == MonstersInRangeW and MonstersInRangeW > MonstersInRangeE and MonstersInRangeW > MonstersInRangeS and MonstersInRangeW > MonstersInRangeN then bestdirection = 3 end if direction == 0 then MonstersInActualRange = MonstersInRangeN end if direction == 1 then MonstersInActualRange = MonstersInRangeE end if direction == 2 then MonstersInActualRange = MonstersInRangeS end if direction == 3 then MonstersInActualRange = MonstersInRangeW end return MonstersInRangeN,MonstersInRangeE,MonstersInRangeS,MonstersInRangeW,MonstersInActualRange,bestdirection end local MonstersInRangeN, MonstersInRangeE, MonstersInRangeS, MonstersInRangeW, MonstersInActualRange, bestdirection = wave5x3() local player = g_game.getLocalPlayer() local checkRange = 5 local monsterinrange = 3 local monsterinrangestand = 1 local monsteraround2 = #g_game.getMonstersAround(2) local monsteraround1 = #g_game.getMonstersAround(1) local manapercent = g_game.getLocalPlayer():getManaPercent() if a == nil then a = 0 end if a ~= nil and a > 3 and monsteraround1 >= MonstersInActualRange and monsteraround1 >= 1 and g_game.isAttacking() and g_game.getIdleTime() > 300 then g_game.turn(g_game.getBestTurnDirection()) a = 0 end if g_game.isAttacking() then if manapercent >= 20 and monsteraround2 >= monsterinrange then g_game.sendKey("Fx") end if manapercent >= 20 and monsteraround2 >= monsterinrange*2 then g_game.sendKey("Fx") end if manapercent >= 20 and MonstersInActualRange >= 2 then g_game.sendKey("Fx") end if manapercent >= 20 and MonstersInActualRange >= monsterinrange then g_game.sendKey("Fx") end if manapercent >= 20 and MonstersInActualRange >= monsterinrange then g_game.sendKey("Fx") end end if a ~= nil then a=a+1 end auto(250)
    1 point
×
×
  • Create New...