Movement:
.lua
-- Do not remove the credits --
-- [MOVEMENT] Secret Teleport --
-- Developed by Rigby (João Vitor) --
local fields = {1492, 1495} -- id do fire field e energy field
local tile1 = {x = 1066, y = 1020, z = 7, stackpos= 1} -- Posição do tile 1
local tile2 = {x = 1068, y = 1020, z = 7, stackpos= 1} -- Posição do tile 2
local statue_Of_Position = {x = 1067, y = 1020, z = 7} -- posição onde fica a estátua, que ira aparecer o teleport
local teleport = {x = 1066, y = 1020, z = 7} -- posição da onde o player vai quando entrar no teleport
local go_Backward = {x = 1067, y = 1019, z = 7} -- Posição para aonde a estátua vai
local statue = 3697 -- id da estátua
local tempo = 5 -- tempo em segundos que o teleporte ficara aberto
function onAddItem(cid, moveitem, tileitem, position)
local pos1 = getThingfromPos(tile1)
local pos2 = getThingfromPos(tile2)
if (pos1.itemid == fields[1] and pos2.itemid == fields[2]) or (pos1.itemid == fields[2] and pos2.itemid == fields[1]) then
if getItemStack(statue_Of_Position, statue) then
doRemoveItem(getItemStack(statue_Of_Position, statue).uid, 1)
local teleport = doCreateItem(1387, 1, statue_Of_Position)
doItemSetAttribute(teleport, "aid", 5555) -- actionid
doCreateItem(statue, 1, go_Backward)
if getItemStack(tile1, fields[1]) then
doRemoveItem(getItemStack(tile1, fields[1]).uid, 1)
doRemoveItem(getItemStack(tile2, fields[2]).uid, 1)
else
doRemoveItem(getItemStack(tile1, fields[2]).uid, 1)
doRemoveItem(getItemStack(tile2, fields[1]).uid, 1)
end
addEvent(function()
doCreateItem(statue, 1, statue_Of_Position)
doRemoveItem(getItemStack(statue_Of_Position, 1387).uid, 1)
doRemoveItem(getItemStack(go_Backward, statue).uid, 1)
end, tempo*1000)
end
end
if getItemStack(go_Backward, statue) then
if getItemStack(tile1, fields[1]) then
doRemoveItem(getItemStack(tile1, fields[1]).uid, 1)
elseif getItemStack(tile1, fields[2]) then
doRemoveItem(getItemStack(tile1, fields[2]).uid, 1)
elseif getItemStack(tile2, fields[1]) then
doRemoveItem(getItemStack(tile2, fields[1]).uid, 1)
elseif getItemStack(tile2, fields[2]) then
doRemoveItem(getItemStack(tile2, fields[2]).uid, 1)
end
end
end
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Bem vindo.")
doTeleportThing(cid, teleport)
return true
end
function getItemStack(pos, iid)
for i = 1, 255 do
posa = getThingFromPos({x=pos.x, y=pos.y, z=pos.z, stackpos=i})
if posa.itemid == iid then
return posa
end
end
return nil
end
.xml, tag
<movevent type="AddItem" tileitem="1" actionid="13501" event="script" value="Nomedoscript.lua"/>
<movevent type="StepIn" actionid="5555" event="script" value="Nomedoscript.lua"/>