Jump to content

Request Script


Zelek

Recommended Posts

Hello, need script for follow player based on name, which do not disturb targeting, based on read send of position to move

 

Something like:
 

local toFollow = storage.followFriend
local toFollowPos = {}

local followMacro = macro(20, "follow target", function()
  local target = getCreatureByName(toFollow)
  if target then
    local tpos = target:getPosition()
    toFollowPos[tpos.z] = tpos
  end
  if player:isWalking() then return end
  local p = toFollowPos[posz()]
  if not p then return end if autoWalk(p, 20, {ignoreNonPathable=true, precision=1, ignoreStairs=false}) then
    delay(100)
  end
end)
addTextEdit("followfriend", storage.followFriend or "", function(widget, text)
  storage.followFriend = text
end)

onCreaturePositionChange(function(creature, newPos, oldPos)
  if creature:getName() == toFollow then
    toFollowPos[newPos.z] = newPos
  end
end)

 

Edited by zakne11
added example
Link to comment
Share on other sites

Quote

local healthToCast = 60
local spellToCast = "exori"
local player = g_game.getLocalPlayer()
if g_game.isAttacking() and player:getHealthPercent() >= healthToCast then
  g_game.talk(spellToCast)
  sleep(900, 1200)
end
auto(100)

 

Could you add 2 conditions?

Like mana req and monster distance?

Edited by Grotos
Link to comment
Share on other sites

1 hour ago, Grotos said:

 

Could you add 2 conditions?

Like mana req and monster distance?


 

local healthToCast = 60

local manaToCast = xx

local range = x

local monsterquantity = x


local spellToCast = "exori"
local player = g_game.getLocalPlayer()
if g_game.isAttacking() and player:getHealthPercent() >= healthToCast and player:getManaPercent()>= manaToCast and #g_game.getMonstersAround(range) >= monsterquantity then
  g_game.talk(spellToCast)
  sleep(900, 1200)
end
auto(100)

 

 

 

Edited by zakne11
  • Like 1
Link to comment
Share on other sites

2 hours ago, Msgsanta said:

it needs a script to lure monsters, but when the monster has 50%, it kills it before it disappears

if not g_game.isAttacking() then
  for _, creature in pairs(g_game.getCreatures()) do
    if creature:isMonster() and creature:getHealthPercent() <= 50 then	
      g_game.attack(creature)
      return
    end
  end
end


If you add it to previous lure it should solve your request.

Link to comment
Share on other sites

Any script for turning targeting ON if i get stuck by mobs? I'm using lure script with "true" on ignoring monsters when luring because of that if i do not that the bot will stops on 1 monsters even if i have chosen like 5 or 8 in targeting?

Link to comment
Share on other sites

Better Turn to target.

 

And im lookin for one more script for attack spells only if there are monsters within 3 sqms

And script that attack with wave spell this side where is more monster in 8 sqms i mean like west are 3 monsters and east are coming 8, so it should turn to east and wave

Edited by Rise
Link to comment
Share on other sites

On 1/11/2021 at 12:38 AM, lediv said:

script to reply to bot check on dbl? it's like a system messege not prive nor default. is that possible?

Currently there is a bug that prevents some messages from being captured, it will be fixed in the next version and script that I posted before in this topic will work. 

 

  • Like 1
Link to comment
Share on other sites

On 1/10/2021 at 2:20 PM, Rise said:

Better Turn to target.

 

And im lookin for one more script for attack spells only if there are monsters within 3 sqms

And script that attack with wave spell this side where is more monster in 8 sqms i mean like west are 3 monsters and east are coming 8, so it should turn to east and wave

 

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)

 

  • Like 1
Link to comment
Share on other sites

1 hour ago, zakne11 said:

 

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)

 

Could you explain me this script? Don't understand last lines when i put hotkeys for that much spells?

Link to comment
Share on other sites

×
×
  • Create New...