Hello guys,
my shovel is working on "items" on the floor, i can use shovel in items.
Screenshot of my problem
Imgur
Well... how could add a function to "return false" if have a item on the ground?
This is my script
thanks for help guys
my shovel is working on "items" on the floor, i can use shovel in items.
Screenshot of my problem
Imgur
Well... how could add a function to "return false" if have a item on the ground?
This is my script
LUA:
function onUse(player, item, fromPosition, target, toPosition)
local tile = Tile(toPosition)
if not tile then
return false
end
local ground = tile:getGround()
if not ground then
return false
end
if ground:getId() == 231 then
ground:getPosition():sendMagicEffect(3)
return true
elseif ground:getId() == 593 then
ground:transform(594, 1)
ground:decay()
doRelocate(ground:getPosition(), ground:getPosition():moveRel(0,0,1))
return true
elseif ground:getId() == 606 then
ground:transform(607, 1)
ground:decay()
doRelocate(ground:getPosition(), ground:getPosition():moveRel(0,0,1))
return true
elseif ground:getId() == 608 then
ground:transform(609, 1)
ground:decay()
doRelocate(ground:getPosition(), ground:getPosition():moveRel(0,0,1))
elseif ground:getId() == 614 and math.random(1, 100) <= 50 then
ground:transform(615, 1)
ground:decay()
ground:getPosition():sendMagicEffect(3)
doRelocate(ground:getPosition(), ground:getPosition():moveRel(0,0,1))
elseif ground:getId() == 614 then
ground:getPosition():sendMagicEffect(3)
elseif ground:getId() == 616 and math.random(1, 100) <= 71 then
ground:transform(617, 1)
ground:decay()
ground:getPosition():sendMagicEffect(3)
Game.createMonster("scarab", ground:getPosition())
elseif ground:getId() == 616 then
ground:getPosition():sendMagicEffect(3)
Game.createItem(3042, 1, ground:getPosition())
ground:transform(617, 1)
ground:decay()
elseif ground:getId() == 617 then
ground:getPosition():sendMagicEffect(3)
else
return false
end
return true
end
thanks for help guys
