Hello.
This is a basic script to pickup spears/small stones to a BACKPACK, it's able to move dead bodies away and pickup.
It will disable TARGETING, CAVEBOT and LOOTER to pickup the spears and enable it again.
I will NOT give any support on this script, not even to fix bugs. So please, don't ask for help or so, because you will be ignored.
This is a basic script to pickup spears/small stones to a BACKPACK, it's able to move dead bodies away and pickup.
It will disable TARGETING, CAVEBOT and LOOTER to pickup the spears and enable it again.
I will NOT give any support on this script, not even to fix bugs. So please, don't ask for help or so, because you will be ignored.
local SPEAR_ID = 1781 -- Spear ID
local SPEAR_BACKPACK = 'blue backpack' -- The backpack that spears/stones will be moved to.
local SPEAR_MIN_AMOUNT = 3 -- Amount start to pickup spears
local SPEAR_MAX_AMOUNT = 5 -- Max. Amount to pickup
local MOVE_BODIES = true -- Move dead bodies to pickup spears
local SPEAR_COUNT = itemcount(SPEAR_ID, SPEAR_BACKPACK, true)
if SPEAR_COUNT < SPEAR_MIN_AMOUNT then
if not MOVE_BODIES then
local player_x = posx()
local player_y = posy()
local player_z = posz()
local disabled_stuff = false
local flag_break = false
for x = -7, 7, 1 do
for y = -5, 5, 1 do
local top_item = topitem(player_x + x, player_y + y, player_z, false)
if top_item.id == SPEAR_ID then
setsettings('Looter/Enabled', false)
setsettings('Cavebot/Enabled', false)
setsettings('Targeting/Enabled', false)
disabled_stuff = true
if reachlocation(player_x + x, player_y + y, player_z) then
wait(800)
local AMOUNT_PICKUP = (SPEAR_MAX_AMOUNT - SPEAR_COUNT)
if AMOUNT_PICKUP > top_item.count then
AMOUNT_PICKUP = 100
end
moveitems(SPEAR_ID, SPEAR_BACKPACK, ground(player_x+ x, player_y + y, player_z), AMOUNT_PICKUP)
wait(800)
flag_break = true
end
end
if flag_break then
break
end
end
if flag_break then
break
end
end
if disabled_stuff then
setsettings('Targeting/Enabled', true)
setsettings('Looter/Enabled', true)
setsettings('Cavebot/Enabled', true)
end
else
if SPEAR_COUNT == 0 or maround(7) == 0 then
local player_z = posz()
local tiles = gettiles()
local disabled_stuff = false
local flag_break = false
for _, tile in ipairs(tiles) do
if tile.itemcount > 1 and tile.posz == player_z then
for __, item in ipairs(tile.items) do
if item.id == SPEAR_ID then
setsettings('Looter/Enabled', false)
setsettings('Cavebot/Enabled', false)
setsettings('Targeting/Enabled', false)
disabled_stuff = true
if reachlocation(tile.posx, tile.posy, tile.posz) then
wait(800)
while true do
local top_item = topitem(tile.posx, tile.posy, tile.posz, false)
if top_item.id == 0 or top_item.id == SPEAR_ID or (posx() == tile.posx and posy() == tile.posy) then
break
end
moveitems(top_item.id, ground(posx(), posy(), posz()), ground(tile.posx, tile.posy, tile.posz), 100)
wait(800)
end
local AMOUNT_PICKUP = (SPEAR_MAX_AMOUNT - SPEAR_COUNT)
if AMOUNT_PICKUP > item.count then
AMOUNT_PICKUP = 100
end
moveitems(SPEAR_ID, SPEAR_BACKPACK, ground(tile.posx, tile.posy, tile.posz), AMOUNT_PICKUP)
wait(800)
SPEAR_COUNT = itemcount(SPEAR_ID, SPEAR_BACKPACK, true)
if SPEAR_COUNT >= SPEAR_MAX_AMOUNT then
flag_break = true
end
end
break
end
end
end
if flag_break then
break
end
end
if disabled_stuff then
setsettings('Targeting/Enabled', true)
setsettings('Looter/Enabled', true)
setsettings('Cavebot/Enabled', true)
end
end
end
end