Por
Denker
O Player será teletransportado para o TC, após sair do TradeCenter o player retornará á cidade de origem, ex:
Saffon > TC , o player retornará a saffron.
---------------------------------------------------------------------------------------------------------------------
Em Data/Movements/Scripts, crie um arquivo.lua e coloque dentro:
-- Developed by: Denker
local configs = {
tps = { -- Teleport para o TC através de um TP (Item) especifico no chão
[ItemID] = {pos = {x = 0, y = 0, z = 0}, storage = 50000}, -- Pallet
[ItemID] = {pos = {x = 0, y = 0, z = 0}, storage = 50001}, -- Viridian
[ItemID] = {pos = {x = 0, y = 0, z = 0}, storage = 50002}, -- Pewter
[ItemID] = {pos = {x = 0, y = 0, z = 0}, storage = 50003}, -- Cerulean
[ItemID] = {pos = {x = 0, y = 0, z = 0}, storage = 50004}, -- Saffron
[ItemID] = {pos = {x = 0, y = 0, z = 0}, storage = 50005}, -- Celadon
[ItemID] = {pos = {x = 0, y = 0, z = 0}, storage = 50006}, -- Vermilion
[ItemID] = {pos = {x = 0, y = 0, z = 0}, storage = 50007}, -- Fuchsia
[ItemID] = {pos = {x = 0, y = 0, z = 0}, storage = 50008}, -- Cinnabar
},
-- LOCALIZAÇÕES
localizacaoPallet = {x= 0, y= 0, z= 0},
localizacaoViridian = {x= 0, y= 0, z= 0},
localizacaoPewter = {x= 0, y= 0, z= 0},
localizacaoCerulean = {x= 0, y= 0, z= 0},
localizacaoSaffron = {x= 0, y= 0, z= 0},
localizacaoCeladon = {x= 0, y= 0, z= 0},
localizacaoVermilion = {x= 0, y= 0, z= 0},
localizacaoFuchsia = {x= 0, y= 0, z= 0},
localizacaoCinnabar = {x= 0, y= 0, z= 0}
}
function onStepIn(cid, item, position, fromPosition)
local tp = configs.tps[item.itemid]
if tp then
doTeleportThing(cid, tp.pos)
setPlayerStorageValue(cid, tp.storage, 1)
return true
end
-- Verificação que irá teletransportar o player de acordo com a city que ele estava antes
if (item.itemid == ItemID ) and getPlayerStorageValue(cid, 50000) == 1 then
doTeleportThing(cid, configs.localizacaoPallet)
setPlayerStorageValue(cid, 50000, 0)
doPlayerSendTextMessage(cid, COLOR_MESSAGE_GREEN, "Você foi Teletransportado para Pallet")
return true
end
if (item.itemid == ItemID ) and getPlayerStorageValue(cid, 50001) == 1 then
doTeleportThing(cid, configs.localizacaoViridian)
setPlayerStorageValue(cid, 50001, 0)
doPlayerSendTextMessage(cid, COLOR_MESSAGE_GREEN, "Você foi Teletransportado para Viridian")
return true
end
if (item.itemid == ItemID ) and getPlayerStorageValue(cid, 50002) == 1 then
doTeleportThing(cid, configs.localizacaoPewter)
setPlayerStorageValue(cid, 50002, 0)
doPlayerSendTextMessage(cid, COLOR_MESSAGE_GREEN, "Você foi Teletransportado para Pewter")
return true
end
if (item.itemid == ItemID ) and getPlayerStorageValue(cid, 50003) == 1 then
doTeleportThing(cid, configs.localizacaoCerulean)
setPlayerStorageValue(cid, 50003, 0)
doPlayerSendTextMessage(cid, COLOR_MESSAGE_GREEN, "Você foi Teletransportado para Cerulean")
return true
end
if (item.itemid == ItemID ) and getPlayerStorageValue(cid, 50004) == 1 then
doTeleportThing(cid, configs.localizacaoSaffron)
setPlayerStorageValue(cid, 50004, 0)
doPlayerSendTextMessage(cid, COLOR_MESSAGE_GREEN, "Você foi Teletransportado para Saffron")
return true
end
if (item.itemid == ItemID ) and getPlayerStorageValue(cid, 50005) == 1 then
doTeleportThing(cid, configs.localizacaoCeladon)
setPlayerStorageValue(cid, 50005, 0)
doPlayerSendTextMessage(cid, COLOR_MESSAGE_GREEN, "Você foi Teletransportado para Celadon")
return true
end
if (item.itemid == ItemID ) and getPlayerStorageValue(cid, 50006) == 1 then
doTeleportThing(cid, configs.localizacaoVermilion)
setPlayerStorageValue(cid, 50006, 0)
doPlayerSendTextMessage(cid, COLOR_MESSAGE_GREEN, "Você foi Teletransportado para Vermilion")
return true
end
if (item.itemid == ItemID ) and getPlayerStorageValue(cid, 50007) == 1 then
doTeleportThing(cid, configs.localizacaoFuchsia)
setPlayerStorageValue(cid, 50007, 0)
doPlayerSendTextMessage(cid, COLOR_MESSAGE_GREEN, "Você foi Teletransportado para Fuchsia")
return true
end
if (item.itemid == ItemID ) and getPlayerStorageValue(cid, 50008) == 1 then
doTeleportThing(cid, configs.localizacaoCinnabar)
setPlayerStorageValue(cid, 50008, 0)
doPlayerSendTextMessage(cid, COLOR_MESSAGE_GREEN, "Você foi Teletransportado para Cinnabar")
return true
end
end
OBS: O item ID da verificação de volta, será igual para todas as verificações.
Em Data/Movements/Movements.xml, coloque dentro:
<movevent type="StepIn" itemid="ID" event="script" value="arquivo.lua"/>