View Full Version : Help, use X on X on the ground
Here we go again, I need help with a little lua script to complete the one i am making, so here goes!
i want the lua to "Self.Useitem[Item ID] WithGroundItem[Item ID" like you would put it in a lable
Would love it if someone could help me out with this :D
yompa93
07-02-2016, 12:00 PM
Self.UseItemWithGround(ItemID,x,y,z) Is what you'd have yo use, if you want to use it on a certain item inside a certain range you could use something like this:
ItemID = 1234 -- item to use on
ItemToUse = 1234 -- Item To Use
function UseItem()
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
end
now you can call this function like so:
elseif (labelName == "123456789") then
UseItem()
you might also want to stop the walker and do something like this:
Walker.Stop()
UseItem()
Walker.Start()
I might've made a mistake, havent done much scripting for a while.
On the one you send me it tells me
Error: 'then' expected near '='
When i put it in and try it out.
And 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
So that when it lands on that label it will just run that one and use the item on the grounditem and be done with it haha :D
Btw ty for trying to help me out man :D
yompa93
07-05-2016, 05:01 AM
i edited my the first reply i sent.
Okey so i tried your script but it didnt end up working it seems.
so i went deeper and found out that this script that you made 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
I'm pretty noob on scripting so i might be really off here but isnt it enought to but Cavebot.Start() before the else also? so it does the use then start the cavebot again?
Like i said, im kinda guessing.. :D
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.