endziu2222
New Member
- Joined
- Nov 2, 2010
- Messages
- 49
- Reaction score
- 3
I have this script for use lever to remove rock from location but I would like it to have an extra function which is a timer.
So when you use lever it will remove rock and you receive information for example: You have 30 second before teleport disappears and after 30 seconds you have to go back and open it again.
Any help appreciated
VERSION_OTX_REVSCRIPTS
So when you use lever it will remove rock and you receive information for example: You have 30 second before teleport disappears and after 30 seconds you have to go back and open it again.
Any help appreciated
VERSION_OTX_REVSCRIPTS
Lua:
local lever = Action()
function lever.onUse(player, item, fromPosition, target, toPosition, isHotkey)
local teleportPosition = {x = 1924, y = 1989, z = 13}
local stonePosition = {x = 1924, y = 1987, z = 13}
if item.itemid == 2772 then
local teleport = Game.createItem(1949, 1, teleportPosition)
if teleport then
teleport:setDestination({x = 1920, y = 2007, z = 14})
Position(teleportPosition):sendMagicEffect(CONST_ME_TELEPORT)
end
Tile(stonePosition):getItemById(6289):remove()
item:transform(2773)
elseif item.itemid == 2773 then
Position(stonePosition):hasCreature({x = 1924, y = 1987, z = 113})
Tile(teleportPosition):getItemById(1949):remove()
Position(teleportPosition):sendMagicEffect(CONST_ME_POFF)
Game.createItem(6289, 1, stonePosition)
item:transform(2772)
end
return true
end
lever:uid(20007)
lever:register()