O vyctor17 me pediu esse script e eu achei bem legalzinho. Lembrando que é um script simples e eu sei disso...
Script: Elevador
Autor: iuniX
Testado em: TFS 0.4
Explicações:
Ele funciona basicamente igual o elevador de Kazzordon do Tibia Global. Ele pega o item/player/creature que estiver no andar de baixo e teleporta para cima e vise e versa.
Instalação:
Crie algo parecido com isso no teu server:
1º Andar:
2º Andar:
Scripts:
Tag:
<action actionid="2000;2001" event="script" value="elevador.lua"/>
Crie um arquivo .lua na pasta actions/scripts e coloque o nome de elevador.
Script:
--[[ Lembrando que você só deve configurar as duas actions ids
e colocar as duas alavancas com ids diferntes ]]--
function onUse(cid, item)
local aid1,aid2 = 2000, 2001 --Coloque as duas actions ids que vc colocou no actions.xml
local posTile = {
[aid1] = {x= 619,y= 1107,z= 3,stackpos =STACKPOS_TOP_MOVABLE_ITEM_OR_CREATURE},
[aid2] = {x= 619,y= 1107,z= 4,stackpos =STACKPOS_TOP_MOVABLE_ITEM_OR_CREATURE}
}
local posSwitch = {
[aid1] = {x= 620,y= 1107,z= 3,stackpos = 1},
[aid2] = {x= 620,y= 1107,z= 4,stackpos = 1}
}
local switch = getThingFromPos(posSwitch[item.actionid == aid1 and aid2 or aid1])
if (getThingFromPos(posTile[item.actionid]).uid > 0) or (getThingFromPos(posTile[item.actionid == aid1 and aid2 or aid1]).uid > 0) then
if item.itemid == switch.itemid then
return true
end
local t1 = getThingFromPos(posTile[item.actionid == aid1 and aid2 or aid1]).uid
local t2 = getThingFromPos(posTile[item.actionid]).uid
if t1 > 0 then doTeleportThing(t1,posTile[item.actionid]) end
if t2 > 0 then doTeleportThing(t2, posTile[item.actionid == aid1 and aid2 or aid1]) end
doSendMagicEffect(posTile[item.actionid == aid1 and aid2 or aid1],CONST_ME_POFF)
doSendMagicEffect(posTile[item.actionid],CONST_ME_POFF)
else
doSendMagicEffect(getPlayerPosition(cid),CONST_ME_GROUNDSHAKER)
doPlayerSendCancel(cid,"Precisa ter algo encima do Tile do Elevador para ele teleportar.")
end
doTransformItem(switch.uid,item.itemid)
end