Log in

View Full Version : Need help with lua script :) use item on ground/wall



Tip
07-03-2016, 08:27 PM
Hello i need a bit of help with a Label in my script im making
I want to use a item in my backpack on a special item on the floor/wall so when it comes on the label it does the script and then keeps walking

Is it possible to make that one something more like this
ItemID = 1234 -- item to use on
ItemToUse = 1234 -- Item To Use

elseif (labelName == "123456789") then
for x = -7, 7 do
for y = -7, 7 do
if Map.GetTopUseItem(Self.Position().x + x, Self.Position().y + y, Self.Position().z).id = ItemID then
Self.UseItemWithGround(ItemToUse, Self.Position().x + x, Self.Position().y + y, Self.Position().z)
break
end
end


But the one i made above is not working for me (and yes its in the middle of the script)

Jontor
07-07-2016, 09:58 AM
Try using this:


elseif (labelName == "123456789") then
local pos = Player.pos()

for x = -7, 7 do
for y = -5, 5 do
if (Map.IsItemAtPosition(ItemID, pos.x, pos.y, pos.z)) then
wait(500)
Self.UseItemWithGround(ItemToUse, pos.x, pos.y, pos.z)
return
end
end
end
end


And if it won't work, explain what you're trying to do.

Tip
07-07-2016, 01:47 PM
Okey so i tried your script but it didnt get the location of the char,
so i went deeper and found out that this script is more like the one i wanted

local itemID = {12061, 12063, 12075} -- ItemID of slimes
Module.New('SlimeRemover', function(module)
if (Self.TargetID() ~= 1) then
pos = Self.Position()
for y = -3, 3 do
for x = -3, 3 do
if table.contains(itemID, Map.GetTopUseItem(pos.x + x, pos.y + y, pos.z).id) then
Cavebot.Stop()
Self.UseItemWithGround(12077, pos.x + x, pos.y + y, pos.z)
wait(5500)
else
Cavebot.Start()
end
end
end
end
end)

But when i use it the bot keeps trying to use it over and over and over again so it gets stuck. any help?
Cuz i just want it to use it once on the label and then start walker again and keep running untill next label

kulinia
10-20-2016, 05:19 PM
Try using this:


elseif (labelName == "123456789") then
local pos = Player.pos()

for x = -7, 7 do
for y = -5, 5 do
if (Map.IsItemAtPosition(ItemID, pos.x, pos.y, pos.z)) then
wait(500)
Self.UseItemWithGround(ItemToUse, pos.x, pos.y, pos.z)
return
end
end
end
end


And if it won't work, explain what you're trying to do.

Bro... how can i use a item on other item.. in the same backpack?