03-15-2020, 04:52 PM
Hello, Please, can you make me an action that makes it walk to certain node if char stands for more than X seconds? I have a problem, my cavebot stops on some nodes and it also stops on an action tocheck lootbag and deposit on a bag on the floor. And could you also fix my action? (I would like both so I can easily fix when it happens in every script). Why is the bot stop walking on a few random nodes inside the cave? Below is my action that bugs often. (it does not happens everytime)
local ItemsDrop = { 'Royal helmet', 'gold coin', 'Tower shield' } -- Items that you wanna drop inside the container.
local BackpackLoot = 'blue backpack' -- Backpack that you are carrying to keep loots, it will drop FROM this backpack.
local DropBagPosition = { X = 32795, Y = 32369, Z = 8 } -- Container's location that you wanna open and drop items inside.
--[[ DON'T EDIT BELOW THIS LINE --]]
--[[ DON'T EDIT BELOW THIS LINE --]]
--[[ CREDITS TO ARKILYS --]]
--[[ DON'T EDIT BELOW THIS LINE --]]
--[[ DON'T EDIT BELOW THIS LINE --]]
local startWindowsCount = windowcount()
local currentWindowsCount = -1
for i = 0, 5 do
openitem(0, ground(DropBagPosition.X, DropBagPosition.Y, DropBagPosition.Z), true)
wait(1000)
currentWindowsCount = windowcount()
if currentWindowsCount > startWindowsCount then
break
end
end
if currentWindowsCount > startWindowsCount then
table.id(ItemsDrop)
local bagIndex = currentWindowsCount - 1
function tempOpenNextContainer(bagContainer)
local emptyLeft = bagContainer.maxslots - bagContainer.usedslots
while emptyLeft == 0 do
for _, bagItem in ipairs(bagContainer.items) do
if itemhasflags(bagItem.id, 4) then
openitem(bagItem.id, bagContainer.index)
wait(1000)
bagContainer = getcontainer(bagContainer.index)
if bagContainer ~= nil and bagContainer.maxslots ~= nil then
emptyLeft = bagContainer.maxslots - bagContainer.usedslots
break
else
return
end
end
emptyLeft = -1
end
end
if emptyLeft > 0 then
return bagContainer
else
return nil
end
end
local bagContainer = tempOpenNextContainer(getcontainer(bagIndex))
if bagContainer ~= nil and bagContainer.maxslots ~= nil then
emptyLeft = bagContainer.maxslots - bagContainer.usedslots
if emptyLeft > 0 then
for i,j in ipairs(ItemsDrop) do
if table.find(ItemsDrop, j) ~= nil then
while itemcount(j, BackpackLoot) > 0 do
if emptyLeft == 0 then
bagContainer = tempOpenNextContainer(getcontainer(bagContainer.index))
if bagContainer ~= nil and bagContainer.maxslots ~= nil then
emptyLeft = bagContainer.maxslots - bagContainer.usedslots
end
end
moveitems(j, bagContainer.index, BackpackLoot, 100)
wait(300)
emptyLeft = emptyLeft - 1
end
end
end
end
end
end
local ItemsDrop = { 'Royal helmet', 'gold coin', 'Tower shield' } -- Items that you wanna drop inside the container.
local BackpackLoot = 'blue backpack' -- Backpack that you are carrying to keep loots, it will drop FROM this backpack.
local DropBagPosition = { X = 32795, Y = 32369, Z = 8 } -- Container's location that you wanna open and drop items inside.
--[[ DON'T EDIT BELOW THIS LINE --]]
--[[ DON'T EDIT BELOW THIS LINE --]]
--[[ CREDITS TO ARKILYS --]]
--[[ DON'T EDIT BELOW THIS LINE --]]
--[[ DON'T EDIT BELOW THIS LINE --]]
local startWindowsCount = windowcount()
local currentWindowsCount = -1
for i = 0, 5 do
openitem(0, ground(DropBagPosition.X, DropBagPosition.Y, DropBagPosition.Z), true)
wait(1000)
currentWindowsCount = windowcount()
if currentWindowsCount > startWindowsCount then
break
end
end
if currentWindowsCount > startWindowsCount then
table.id(ItemsDrop)
local bagIndex = currentWindowsCount - 1
function tempOpenNextContainer(bagContainer)
local emptyLeft = bagContainer.maxslots - bagContainer.usedslots
while emptyLeft == 0 do
for _, bagItem in ipairs(bagContainer.items) do
if itemhasflags(bagItem.id, 4) then
openitem(bagItem.id, bagContainer.index)
wait(1000)
bagContainer = getcontainer(bagContainer.index)
if bagContainer ~= nil and bagContainer.maxslots ~= nil then
emptyLeft = bagContainer.maxslots - bagContainer.usedslots
break
else
return
end
end
emptyLeft = -1
end
end
if emptyLeft > 0 then
return bagContainer
else
return nil
end
end
local bagContainer = tempOpenNextContainer(getcontainer(bagIndex))
if bagContainer ~= nil and bagContainer.maxslots ~= nil then
emptyLeft = bagContainer.maxslots - bagContainer.usedslots
if emptyLeft > 0 then
for i,j in ipairs(ItemsDrop) do
if table.find(ItemsDrop, j) ~= nil then
while itemcount(j, BackpackLoot) > 0 do
if emptyLeft == 0 then
bagContainer = tempOpenNextContainer(getcontainer(bagContainer.index))
if bagContainer ~= nil and bagContainer.maxslots ~= nil then
emptyLeft = bagContainer.maxslots - bagContainer.usedslots
end
end
moveitems(j, bagContainer.index, BackpackLoot, 100)
wait(300)
emptyLeft = emptyLeft - 1
end
end
end
end
end
end
