Olá gente, queria a ajuda de vcs para modificar uma script de porta automática, tipo, a pessoa pisa em tal tile que contem uma action, e a porta se abre, bem, eu tenho a script aqui, mas ela só serve para uma porta, queria configurar para pegar mais portas nessa mesma script.
Script
-- Do not remove the credits --
-- [MOVEMENT] Porta que abre automáticamente --
-- Developed by Rigby (João Vitor) --
-- Xtibia.com --
local porta = {621, 622, 605} -- porta fechada, porta meio aberta, porta aberta
local pos = {x = 1056, y = 1058, z = 7} -- local onde vai fica a porta
local delay = 150 -- ela vai demorar 0.1 segundos para fica totalmente aberta ou totalmente fechada
local action = 2701 -- action que ta no .xml, se muda la vai ter que muda aqui também
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
if getTileItemById(pos, porta[1]).uid > 0 then
for i = 1, 2 do
addEvent(function()
doTransformItem(getTileItemById(pos, i == 1 and porta[1] or porta[2]).uid, porta[i + 1])
end, i * delay)
end
end
return true
end
function onStepOut(cid, item, position, lastPosition, fromPosition, toPosition, actor)
local tab = {}
for _, pid in ipairs(getPlayersOnline()) do
if getTileInfo(getCreaturePosition(pid)).actionid == action then
table.insert(tab, pid)
end
end
if #tab == 0 then
if getTileItemById(pos, porta[3]).uid > 0 then
for i = 1, 2 do
addEvent(function()
doTransformItem(getTileItemById(pos, i == 1 and porta[3] or porta[2]).uid, porta[i == 1 and 2 or 1])
end, i * delay)
end
end
end
return true
end
Pergunta
Developer Berg 65
Olá gente, queria a ajuda de vcs para modificar uma script de porta automática, tipo, a pessoa pisa em tal tile que contem uma action, e a porta se abre, bem, eu tenho a script aqui, mas ela só serve para uma porta, queria configurar para pegar mais portas nessa mesma script.
Script
-- Do not remove the credits -- -- [MOVEMENT] Porta que abre automáticamente -- -- Developed by Rigby (João Vitor) -- -- Xtibia.com -- local porta = {621, 622, 605} -- porta fechada, porta meio aberta, porta aberta local pos = {x = 1056, y = 1058, z = 7} -- local onde vai fica a porta local delay = 150 -- ela vai demorar 0.1 segundos para fica totalmente aberta ou totalmente fechada local action = 2701 -- action que ta no .xml, se muda la vai ter que muda aqui também function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor) if getTileItemById(pos, porta[1]).uid > 0 then for i = 1, 2 do addEvent(function() doTransformItem(getTileItemById(pos, i == 1 and porta[1] or porta[2]).uid, porta[i + 1]) end, i * delay) end end return true end function onStepOut(cid, item, position, lastPosition, fromPosition, toPosition, actor) local tab = {} for _, pid in ipairs(getPlayersOnline()) do if getTileInfo(getCreaturePosition(pid)).actionid == action then table.insert(tab, pid) end end if #tab == 0 then if getTileItemById(pos, porta[3]).uid > 0 then for i = 1, 2 do addEvent(function() doTransformItem(getTileItemById(pos, i == 1 and porta[3] or porta[2]).uid, porta[i == 1 and 2 or 1]) end, i * delay) end end end return true endDou Rep + Para Quem Me Ajudar
Link para o comentário
https://xtibia.com/forum/topic/236376-modificar-script-de-porta-automatica/Compartilhar em outros sites
18 respostass a esta questão
Posts Recomendados