lhe recomendo fazer 1 script por cada porta, se quiser posso editar esse mais tarde caso queira que solucione logo seu pedido seria melhor 1 script por cada porta.
info
Grupo: Lorde
Registrado: 22/07/12
Posts: 2.2k
Reputação: +453
Char no Tibia: Kissy

info
Grupo: Conde
Registrado: 12/04/15
Posts: 655
Reputação: +65
Gênero: Masculino
Char no Tibia: Developer Berg

lhe recomendo fazer 1 script por cada porta, se quiser posso editar esse mais tarde caso queira que solucione logo seu pedido seria melhor 1 script por cada porta.
ss talvez seria, mas seria muitas scripts a fazer, pq vou fazer com muitas portas, mas pq seria melhor fazer 1 script para cada porta ?
info
Grupo: Lorde
Registrado: 22/07/12
Posts: 2.2k
Reputação: +453
Char no Tibia: Kissy

por que mais de 1 uma porta vai da muito trabalho pra fazer por causa que tem ligação com actions e além de tudo é moveevents vai dá um trabalho horroroso pra quem for fazer além de uma demora é os testes que vai ser necessário fazer. Por isso acho melhor você fazer 1 script por porta.
info
Grupo: Marquês
Registrado: 03/02/13
Posts: 1.2k
Reputação: +254
Gênero: Masculino
Char no Tibia: Partiu Baladinha

Talvez se você usar por exemplo:
if item.uid == 7501 or item.uid == 7502 or item.uid == 7503 or item.uid == 7504 then
(a ordem que escolhi seria a action a ser disposta nas portas com UNIQUE ID.
Isso se as portas forem de mesmo ID. E no caso você declararia com:
fromuid="7501" touid="7504" script=""/>
É só uma base, não sei se vai funcionar.
Editado Agosto 20 por Lumus
info
Grupo: Conde
Registrado: 12/04/15
Posts: 655
Reputação: +65
Gênero: Masculino
Char no Tibia: Developer Berg

Talvez se você usar por exemplo:
if item.uid == 7501 or item.uid == 7502 or item.uid == 7503 or item.uid == 7504 then(a ordem que escolhi seria a action a ser disposta nas portas com UNIQUE ID.
Isso se as portas forem de mesmo ID. E no caso você declararia com:
fromuid="7501" touid="7504" script=""/>É só uma base, não sei se vai funcionar.
n funcionou ![]()
info
Grupo: Marquês
Registrado: 03/02/13
Posts: 1.2k
Reputação: +254
Gênero: Masculino
Char no Tibia: Partiu Baladinha

Mentira, eu vacilei, o certo seria declarar numa tabela tipo essa:
local porta = {621, 622, 605} -- porta fechada, porta meio aberta, porta aberta
local portas = {
[1] = {pos = {x = 1056, y = 1058, z = 7}, tempo = , action = },
[2] = {pos = {x = 1056, y = 1058, z = 7}, tempo = , action = },
[3] = {pos = {x = 1056, y = 1058, z = 7}, tempo = , action = },
[4] = {pos = {x = 1056, y = 1058, z = 7}, tempo = , action = },
}
E puxar com o FOR e etc... veja:
Ex:
for i = 1, #portas do
...
end
Editado Agosto 20 por Lumus
info
Grupo: Conde
Registrado: 12/04/15
Posts: 655
Reputação: +65
Gênero: Masculino
Char no Tibia: Developer Berg

Mentira, eu vacilei, o certo seria declarar numa tabela tipo essa:
local porta = {621, 622, 605} -- porta fechada, porta meio aberta, porta aberta local portas = { [1] = {pos = {x = 1056, y = 1058, z = 7}, tempo = , action = }, [2] = {pos = {x = 1056, y = 1058, z = 7}, tempo = , action = }, [3] = {pos = {x = 1056, y = 1058, z = 7}, tempo = , action = }, [4] = {pos = {x = 1056, y = 1058, z = 7}, tempo = , action = }, }E puxar com o FOR e etc... veja:
Ex:
for i = 1, #portas do ... end
n entendi essa ultima parte ae, tipo, eu coloco isso onde ?
for i = 1, #portas do
...
end
info
Grupo: Lorde
Registrado: 22/07/12
Posts: 2.2k
Reputação: +453
Char no Tibia: Kissy

-- 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 portas = {
[1] = {pos = {x = 1056, y = 1058, z = 7}, tempo = 1, action = actionid },
[2] = {pos = {x = 1056, y = 1058, z = 7}, tempo = 1, action = actionid },
[3] = {pos = {x = 1056, y = 1058, z = 7}, tempo = 1, action = actionid },
[4] = {pos = {x = 1056, y = 1058, z = 7}, tempo = 1, action = actionid },
}
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) for i = 1, #portas do
for i = 1, #portas do
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
end
end
function onStepOut(cid, item, position, lastPosition, fromPosition, toPosition, actor)
local tab = {}
for _, pid in ipairs(getPlayersOnline()) do
if getTileInfo(getCreaturePosition(pid)).actionid == portas[i].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
fiz o que o lumus falou não testei....
info
Grupo: Conde
Registrado: 12/04/15
Posts: 655
Reputação: +65
Gênero: Masculino
Char no Tibia: Developer Berg

-- 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 portas = { [1] = {pos = {x = 1056, y = 1058, z = 7}, tempo = 1, action = actionid }, [2] = {pos = {x = 1056, y = 1058, z = 7}, tempo = 1, action = actionid }, [3] = {pos = {x = 1056, y = 1058, z = 7}, tempo = 1, action = actionid }, [4] = {pos = {x = 1056, y = 1058, z = 7}, tempo = 1, action = actionid }, } 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) for i = 1, #portas do for i = 1, #portas do 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 end end function onStepOut(cid, item, position, lastPosition, fromPosition, toPosition, actor) local tab = {} for _, pid in ipairs(getPlayersOnline()) do if getTileInfo(getCreaturePosition(pid)).actionid == portas[i].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 endfiz o que o lumus falou não testei....
deu esse erro aqui
-- 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 portas = { [1] = {pos = {x = 1056, y = 1058, z = 7}, tempo = 1, action = actionid }, [2] = {pos = {x = 1056, y = 1058, z = 7}, tempo = 1, action = actionid }, [3] = {pos = {x = 1056, y = 1058, z = 7}, tempo = 1, action = actionid }, [4] = {pos = {x = 1056, y = 1058, z = 7}, tempo = 1, action = actionid }, } 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) for i = 1, #portas do for i = 1, #portas do 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 end end function onStepOut(cid, item, position, lastPosition, fromPosition, toPosition, actor) local tab = {} for _, pid in ipairs(getPlayersOnline()) do if getTileInfo(getCreaturePosition(pid)).actionid == portas[i].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 endfiz o que o lumus falou não testei....
Nesse caso seria para um tipo de porta, e como fazer para por a outra posição, tipo se essa for na horizontal e eu queira adicionar tb na vertical que seriam outros ids de portas, tem como adaptar para eu testar?
info
Grupo: Lorde
Registrado: 22/07/12
Posts: 2.2k
Reputação: +453
Char no Tibia: Kissy

-- 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 portas = {
[1] = {pos = {x = 1056, y = 1058, z = 7}, tempo = 1, action = actionid },
[2] = {pos = {x = 1056, y = 1058, z = 7}, tempo = 1, action = actionid },
[3] = {pos = {x = 1056, y = 1058, z = 7}, tempo = 1, action = actionid },
[4] = {pos = {x = 1056, y = 1058, z = 7}, tempo = 1, action = actionid },
}
local delay = 150 -- ela vai demorar 0.1 segundos para fica totalmente aberta ou totalmente fechada
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor) for i = 1, #portas do
for i = 1, #portas do
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
end
end
function onStepOut(cid, item, position, lastPosition, fromPosition, toPosition, actor)
local tab = {}
for _, pid in ipairs(getPlayersOnline()) do
if getTileInfo(getCreaturePosition(pid)).actionid == portas.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
info
Grupo: Marquês
Registrado: 03/02/13
Posts: 1.2k
Reputação: +254
Gênero: Masculino
Char no Tibia: Partiu Baladinha

O do Kissy está com erro.
Tente assim:
local porta = {621, 622, 605} -- porta fechada, porta meio aberta, porta aberta
local portas = {
[1] = {pos = {x = 1056, y = 1058, z = 7}, tempo = 150, action = 2701},
[2] = {pos = {x = 1056, y = 1058, z = 7}, tempo = 155, action = 2702},
[3] = {pos = {x = 1056, y = 1058, z = 7}, tempo = 157, action = 2703},
[4] = {pos = {x = 1056, y = 1058, z = 7}, tempo = 158, action = 2704},
}
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
if getTileItemById(portas.pos, porta[1]).uid > 0 then
for i = 1, 2 do
addEvent(function()
doTransformItem(getTileItemById(portas.pos, i == 1 and porta[1] or porta[2]).uid, porta[i + 1])
end, i * portas.tempo)
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 == portas.action then
table.insert(tab, pid)
end
end
if #tab == 0 then
if getTileItemById(portas.pos, porta[3]).uid > 0 then
for i = 1, 2 do
addEvent(function()
doTransformItem(getTileItemById(portas.pos, i == 1 and porta[3] or porta[2]).uid, porta[i == 1 and 2 or 1])
end, i * portas.tempo)
end
end
end
return true
end
info
Grupo: Conde
Registrado: 12/04/15
Posts: 655
Reputação: +65
Gênero: Masculino
Char no Tibia: Developer Berg

O do Kissy está com erro.
Tente assim:
local porta = {621, 622, 605} -- porta fechada, porta meio aberta, porta aberta local portas = { [1] = {pos = {x = 1056, y = 1058, z = 7}, tempo = 150, action = 2701}, [2] = {pos = {x = 1056, y = 1058, z = 7}, tempo = 155, action = 2702}, [3] = {pos = {x = 1056, y = 1058, z = 7}, tempo = 157, action = 2703}, [4] = {pos = {x = 1056, y = 1058, z = 7}, tempo = 158, action = 2704}, } function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor) if getTileItemById(portas.pos, porta[1]).uid > 0 then for i = 1, 2 do addEvent(function() doTransformItem(getTileItemById(portas.pos, i == 1 and porta[1] or porta[2]).uid, porta[i + 1]) end, i * portas.tempo) 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 == portas.action then table.insert(tab, pid) end end if #tab == 0 then if getTileItemById(portas.pos, porta[3]).uid > 0 then for i = 1, 2 do addEvent(function() doTransformItem(getTileItemById(portas.pos, i == 1 and porta[3] or porta[2]).uid, porta[i == 1 and 2 or 1]) end, i * portas.tempo) end end end return true end
lumos, deu esse erro
Nesse caso seria para um tipo de porta, e como fazer para por a outra posição, tipo se essa for na horizontal e eu queira adicionar tb na vertical que seriam outros ids de portas, tem como adaptar para eu testar?
tiaiger, eu criei uma nova script para as horizontais, mudei os ids e as actions e funcionou
Editado Agosto 20 por ricardoberg
Ambos os scripts da erro.
[20/08/2015 20:47:14] [Error - MoveEvents Interface] [20/08/2015 20:47:14] data/movements/scripts/PortasAutomaticas.lua:onStepIn [20/08/2015 20:47:14] Description: [20/08/2015 20:47:14] attempt to index a nil value [20/08/2015 20:47:14] stack traceback: [20/08/2015 20:47:14] [C]: in function 'getTileItemById' [20/08/2015 20:47:14] data/movements/scripts/PortasAutomaticas.lua:11: in function <data/movements/scripts/PortasAutomaticas.lua:10> [20/08/2015 20:47:15] [Error - MoveEvents Interface] [20/08/2015 20:47:15] data/movements/scripts/PortasAutomaticas.lua:onStepOut [20/08/2015 20:47:15] Description: [20/08/2015 20:47:15] attempt to index a nil value [20/08/2015 20:47:15] stack traceback: [20/08/2015 20:47:15] [C]: in function 'getTileItemById' [20/08/2015 20:47:15] data/movements/scripts/PortasAutomaticas.lua:28: in function <data/movements/scripts/PortasAutomaticas.lua:20>



info
Grupo: Conde
Registrado: 12/04/15
Posts: 655
Reputação: +65
Gênero: Masculino
Char no Tibia: Developer Berg
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