local config = {
pickaxeusedon = 1285,-- ID of item pickaxe was used on
pickuse = Position(993, 1007, 7), -- where do you need to use the pickaxe
passage = Position(992, 1007, 7), -- where does the hole appear
spawn = 383, -- ID of the hole
cover = 836, -- ID of the item that will cover the hole
time = 3*1000 -- How much time before the hole closes again, change 3 to anything you want.
}
local function fixStone(pos)
local item = Tile(pos):getItemById(1336)
if item then
item:transform(1285)
config.pickuse:sendMagicEffect(CONST_ME_POFF)
end
Game.createItem(config.cover, 1, config.passage)
end
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if (toPosition == config.pickuse) and (target:isItem() and target.itemid == config.pickaxeusedon) then
config.passage:sendMagicEffect(CONST_ME_POFF)
target:transform(1336)
Game.createItem(config.spawn, 1, config.passage)
addEvent(fixStone, config.time, toPosition)
return true
end
return false
end