I found this script on the orts data pack. I tried to use it on OTHire 0.0.3 but It failed to load.
Can anyone help me to get this to work with othire if that's possible?
Can anyone help me to get this to work with othire if that's possible?
Code:
attempt to call global 'Position' (a nil value)
Warning: [Event::loadScript] Can not load script.
Code:
local config = {
[50000] = {position = Position(885, 1183, 8), revert = true},
[50001] = {position = Position(888, 1184, 8), revert = true},
[50002] = {position = Position(891, 1182, 8)},
time = 100
}
local function revertWall(wallPosition, leverPosition)
local leverItem = Tile(leverPosition):getItemById(1946)
if leverItem then
leverItem:transform(1945)
end
Game.createItem(1498, 1, wallPosition)
end
local function removeWall(position)
local tile = position:getTile()
if not tile then
return
end
local thing = tile:getItemById(1498)
if thing then
thing:remove()
position:sendMagicEffect(CONST_ME_MAGIC_RED)
end
end
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if item.itemid ~= 1945 then
player:sendCancelMessage('The lever has already been used.')
return true
end
local wall = config[item.uid]
removeWall(wall.position)
if wall.revert then
addEvent(revertWall, config.time * 1000, wall.position, toPosition)
end
item:transform(1946)
return true
end
Last edited: