<action uniqueid="3000" script="other/wall.lua"/>
local function doChangeWallBack(pos, currentid, oldid)
local newItem = Tile(pos):getItemById(currentid)
if newItem then
newItem:transform(oldid)
pos:sendMagicEffect(CONST_ME_MAGIC_BLUE)
end
end
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if item.itemid == 1026 then
item:transform(6281)
player:addItem(2112, 1)
player:sendTextMessage(MESSAGE_INFO_DESCR, "You found some item in the wall.")
fromPosition:sendMagicEffect(CONST_ME_MAGIC_BLUE)
addEvent(doChangeWallBack, 30 * 1000, fromPosition, 6281, 1026)
end
return true
end
local function doChangeWallBack(pos, currentid, oldid)
local newItem = Tile(pos):getItemById(currentid)
if newItem then
newItem:transform(oldid)
pos:sendMagicEffect(CONST_ME_MAGIC_BLUE)
end
end
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if item.itemid == 1026 then
if player:removeItem(5901, 1) then
item:transform(6281)
player:sendTextMessage(MESSAGE_INFO_DESCR, "You lost some wood.")
fromPosition:sendMagicEffect(CONST_ME_MAGIC_BLUE)
addEvent(doChangeWallBack, 30 * 1000, fromPosition, 6281, 1026)
else
player:sendTextMessage(MESSAGE_INFO_DESCR, "You can't do this.")
end
end
return true
end