Joriku
Working in the mines, need something?
Hi,
This can be done through revscript aswell.
But I've tried alot of diffrent combinations but I can't manage to solve this without getting an null error.
here's the code for one item spot. Trying to make it remove the same item id on two locations.
This can be done through revscript aswell.
But I've tried alot of diffrent combinations but I can't manage to solve this without getting an null error.
here's the code for one item spot. Trying to make it remove the same item id on two locations.
Lua:
local wallPosition = Position(3097, 2945, 7) --wall position
local wall = 1546 --wall ID
local revertTime = 1 * 60 * 100 --time: 1=1min
local function revertWall()
Game.createItem(wall, 1, wallPosition)
wallPosition:sendMagicEffect(CONST_ME_POFF)
Game.broadcastMessage("Bridge Event Closed.", MESSAGE_EVENT_ADVANCE)
end
local function revertLever(position)
local leverItem = Tile(position):getItemById(1946)
if leverItem then
leverItem:transform(1945)
end
end
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if item.itemid == 1945 then
local removeWall = Tile(wallPosition):getItemById(wall)
if removeWall then
removeWall:remove()
wallPosition:sendMagicEffect(CONST_ME_POFF)
Game.broadcastMessage("Bridge Event Open for 30 Minutes!", MESSAGE_EVENT_ADVANCE)
addEvent(revertWall, revertTime)
end
item:transform(1946)
addEvent(revertLever, revertTime, toPosition)
end
return true
end