Quote:
do
local monsterCount = monsterCount
local lureMonsters = {}
local maxWaitTime
function isInDirection(creature, dir)
local dir = dir or Self.LookDirection()
local sPos = Self.Position()
local xPos = creature:Position()
local dx = xPos.x - sPos.x
local dy = xPos.y - sPos.y
if dir == NORTH then
return dy < 0
elseif dir == SOUTH then
return dy > 0
elseif dir == EAST then
return dx > 0
elseif dir == WEST then
return dx < 0
end
end
local function needWait(LongDist, dir)
for _, monster in ipairs(Self.GetTargets(10)) do
if table.find(lureMonsters, monster:Name():lower()) and monster:DistanceFromSelf() >= LongDist and not isInDirection(monster, dir) then
return true
end
end
return false
end
local isLeaving = false
local longDist = 3
local function lureWait(dir)
if not isLeaving and needWait(longDist, dir) and monsterCount(lureMonsters, 2) < 8 then
local sTime = os.time()
while needWait(longDist, dir) and os.difftime(os.time(), sTime) < maxWaitTime and monsterCount(lureMonsters, 2) < 8 do
wait(50)
end
end
end
registerLabelHandler("CheckWaits","CheckWaits", function()
Walker.Goto("NoWaits")
end)
-- Config function
function waitForMonstersWhenLuring(arg)
if arg.active and arg.monsters then
lureMonsters = {}
for _, name in ipairs(arg.monsters) do
table.insert(lureMonsters, name:lower())
end
if arg.dist then
longDist = arg.dist
end
maxWaitTime = arg.maxWaitTime or 3
registerLabelHandler("s", "s", function()
lureWait(SOUTH)
end)
registerLabelHandler("e", "e", function()
lureWait(EAST)
end)
registerLabelHandler("n", "n", function()
lureWait(NORTH)
end)
registerLabelHandler("w", "w", function()
lureWait(WEST)
end)
registerLabelHandler("Kill", "Kill", function()
if not Targeting.IsIgnoring() then
waitAsync(function() return monsterCount(lureMonsters, 5) == 0 end, 60)
end
end)
registerLabelHandler("CheckWaits","CheckWaits", function()
Walker.Goto("Waits")
end)
registerLabelHandler("StartHunt","Enable Lure Waits", function()
isLeaving = false
end)
registerLeaveHandler("Disable Lure Waits", function()
isLeaving = true
end)
end
end
end
Can u make simple script with this wait when luring ?