Hello.
I didn't tried this script, but should work.
LOCATION = Location where the lootbag is.
LOOTBAG_ID = Id of the container that you are using as lootbag. If you are using a brown bag or red backpack for example then you write its id. It's possible to use the container name, because the script itself will use itemid to find search for the id of the name that you use. But it's recommended to use id directly instead of name.
ALERTS = Play alert on 3 specific situations:
1. If non-moveable item has been found, such as fire field;
2. Could not find the specified lootbag on sqm;
3. Failed to find a sqm to move the trash from the lootbag sqm.
If you are going to use on Cavebot->Action then I recommend you to use islocation() or islocationxyz() to make sure you have the lootbag on screen.
local LOCATION = { X = 12345, Y = 12345, Z = 6 }
local LOOTBAG_ID = 1234 -- Lootbag container id.
local ALERTS = true -- Alert if item not moveable on sqm (e.g.: fire field), could not find lootbag or failed to find sqm to move trash.
if type(LOOTBAG_ID) == 'string' then
local tmp = tonumber(LOOTBAG_ID)
if tmp ~= nil then
LOOTBAG_ID = tmp
else
LOOTBAG_ID = itemid(LOOTBAG_ID)
end
end
if LOOTBAG_ID > 0 then
local tile_item = topitem(LOCATION.X, LOCATION.Y, LOCATION.Z, false)
while tile_item.id > 0 and tile_item.id ~= LOOTBAG_ID do
local flags = itemflags(tile_item.id)
if table.find(flags, 13) then
if ALERTS then
print('Found not moveable item on Lootbag SQM: ' .. tile_item.id)
playsound('default')
flashclient()
end
break
elseif table.find(flags, 0) or table.find(flags, 30) then
if ALERTS then
print('Could not find Lootbag on the specific SQM.')
playsound('default')
flashclient()
end
break
end
local where = wheretomoveitem(LOCATION.X, LOCATION.Y, LOCATION.Z, true, 2)
if where.posx <= 0 then
if ALERTS then
print('Could not find a sqm to move trash.')
playsound('default')
flashclient()
end
break
end
moveitems(tile_item.id, ground(where.posx, where.posy, where.posz), ground(LOCATION.X, LOCATION.Y, LOCATION.Z), 100)
wait(500, 700)
tile_item = topitem(LOCATION.X, LOCATION.Y, LOCATION.Z, false)
end
end