Hello,
I was wondering if it's possible to get this script to, once I've pressed the lever in DHQ the stone also has a time and when that set of time has passed the wall reappear again.
I was wondering if it's possible to get this script to, once I've pressed the lever in DHQ the stone also has a time and when that set of time has passed the wall reappear again.
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local cfg = {
p = {
wall_ = { x = 935, y = 978, z = 9 }, -- Where the wall is.
tp = { x = 1123, y = 891, z = 8 }, -- Where the teleport creates.
to = { x = 100, y = 100, z = 7 }, -- Where the teleport takes the player.
lever = { x = 1137, y = 891, z = 8 } -- Where the lever is.
},
time = 60, -- Time the teleport remains open.
level = 10, -- Level to pull the lever.
wall_id = 1355, -- Wall item id.
msg = "Success!" -- Message given after lever is pulled.
}
if(item.itemid == 1945) then
local h = cfg.p
if(getPlayerLevel(cid) >= cfg.level) then
local function resetQuest() return doCreateItem(cfg.wall_id, 1, h.wall_) and doRemoveItem(getTileItemById(h.tp, 1387).uid) and doTransformItem(getTileItemById(h.lever, 1946).uid, 1945) end
return doCreateTeleport(1387, h.to, h.tp) and doRemoveItem(getTileItemById(h.wall_, cfg.wall_id).uid) and doCreatureSay(cid, cfg.msg, TALKTYPE_ORANGE_1) and addEvent(resetQuest, cfg.time * 1000) and doTransformItem(getTileItemById(h.lever, 1945).uid, 1946)
else
doPlayerSendCancel(cid, "Sorry, you your level is too low.")
end
elseif(item.itemid == 1946) then
doPlayerSendCancel(cid, "Sorry, not possible.")
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
end
return true
end