Todos disem que para criar uma porta com chave e apenas colocar a action na porta e a mesma na chave, mais fasso isso no meu ot pelo rme, mais a porta fica abrindo normalmente sem a chave, quando dou use na chave e use na porta n acontece nada, creio q esta faltando as actions no meu ot, alguem ajuda ae
Se você mostra-se o Script, poderiamos ajuda-lo né?
olha n tenho usado nem um script pq esses actions q tem no server teria um numero limitado de portas comk chaves a menos q eu criace mais itens se entendi bem, mais olha isso
o xml da porta com lvl q esta funcionando
<item id="6896" article="a" name="gate of expertise">
<attribute key="type" value="door"/>
<attribute key="levelDoor" value="1000"/>
<attribute key="blockprojectile" value="1"/>
<attribute key="transformUseTo" value="6897"/>
</item>
o da porta com chave q n funfa
<item id="1219" article="a" name="closed door">
<attribute key="type" value="door"/>
<attribute key="blockprojectile" value="1"/>
<attribute key="transformUseTo" value="1220"/>
</item>
ve ae
Seria bem mas simples você usa script:
function onUse(cid, item, frompos, item2, topos) local pausa = 1000 local door = {x=617, y=688, z=7, stackpos=1} local ddoor = getThingfromPos(door) local open_door = 1220 local itemU = 23550 local verify = 0 if item2.uid == itemU then if ddoor.itemid ~= verify then doTransformItem(ddoor.uid,open_door) addEvent(close,pausa,door) end else doPlayerSendCancel(cid,"This key can not be used here") end return 1 end function close(door) local to_close_door = 1219 local the_close_door = getThingfromPos(door) doTransformItem(the_close_door.uid,to_close_door) end
tipo esse script ae ele usa certo item para abrir a porta ne isso, podendo a chave ser pega em quest ou comprada, sendo assim n posso criar outra porta para o mesmo item me limitando a usar apenas umas 10 portas com chave que e o numero de chaves mais ou menos q existem no tibia certo, ou uso uma wooden key (exemplo) que pego apenas uma ves e servira para abriir umas 5 portas diferentes no mapa, eu tava olhando data/actions/scripts/other e achei um com nome de door e dentro tem isso sera que ajuda para porta funfa so no action
local function doorEnter(cid, uid, id, position)
doTransformItem(uid, id)
doTeleportThing(cid, position)
return true
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(fromPosition.x ~= CONTAINER_POSITION and isPlayerPzLocked(cid) and getTileInfo(fromPosition).protection) then
doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
return true
end
local locked = item.aid
if locked == 9999 then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is locked.")
return true
end
local door = getItemInfo(item.itemid)
if(door.levelDoor > 0) then
if(item.aid == 189) then
if(not isPremium(cid)) then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Only the worthy may pass.")
return true
end
return doorEnter(cid, item.uid, door.transformUseTo, toPosition)
end
local gender = item.aid - 186
if(isInArray({PLAYERSEX_FEMALE, PLAYERSEX_MALE}, gender)) then
if(gender ~= getPlayerSex(cid)) then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Only the worthy may pass.")
return true
end
return doorEnter(cid, item.uid, door.transformUseTo, toPosition)
end
local skull = item.aid - 180
if(skull >= SKULL_NONE and skull <= SKULL_BLACK) then
if(skull ~= getCreatureSkullType(cid)) then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Only the worthy may pass.")
return true
end
return doorEnter(cid, item.uid, door.transformUseTo, toPosition)
end
local group = item.aid - 150
if(group >= 0 and group < 30) then
if(group > getPlayerGroupId(cid)) then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Only the worthy may pass.")
return true
end
return doorEnter(cid, item.uid, door.transformUseTo, toPosition)
end
local vocation = item.aid - 100
if(vocation >= 0 and vocation < 50) then
local vocationEx = getVocationInfo(getPlayerVocation(cid))
if(vocationEx.id ~= vocation and vocationEx.fromVocation ~= vocation) then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Only the worthy may pass.")
return true
end
return doorEnter(cid, item.uid, door.transformUseTo, toPosition)
end
if(item.aid == 190 or (item.aid ~= 0 and getPlayerLevel(cid) >= (item.aid - door.levelDoor))) then
return doorEnter(cid, item.uid, door.transformUseTo, toPosition)
end
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Only the worthy may pass.")
return true
end
if(door.specialDoor) then
if(item.aid == 100 or (item.aid ~= 0 and getCreatureStorage(cid, item.aid) > 0)) then
return doorEnter(cid, item.uid, door.transformUseTo, toPosition)
end
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "The door seems to be sealed against unwanted intruders.")
return true
end
toPosition.stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE
local fields, thing = getTileItemsByType(fromPosition, ITEM_TYPE_MAGICFIELD), getThingFromPosition(toPosition)
if(item.uid ~= thing.uid and thing.itemid >= 100 and table.maxn(fields) ~= 0) then
return true
end
local doorCreature = getThingFromPosition(toPosition)
if(doorCreature.itemid ~= 0) then
toPosition.x = toPosition.x + 1
local query = doTileQueryAdd(doorCreature.uid, toPosition, 20) -- allow to stack outside doors, but not on teleports or floor changing tiles
if(query == RETURNVALUE_NOTPOSSIBLE) then
toPosition.x = toPosition.x - 1
toPosition.y = toPosition.y + 1
query = doTileQueryAdd(doorCreature.uid, toPosition, 20) -- repeat until found
end
if(query ~= RETURNVALUE_NOERROR) then
doPlayerSendDefaultCancel(cid, query)
return true
end
doTeleportThing(doorCreature.uid, toPosition)
if(not door.closingDoor) then
doTransformItem(item.uid, door.transformUseTo)
end
return true
end
return false
end
mais vou usar esse seu ae acho q e a unica forma ate agora vlw pela ajuda. grats
Não tem como se limitar com o Limite de Chaves, e so criar outras com Id Proprio.
to com um problema teu script n deu certo, e ja usei uns 5 aq do forum e nem funfa, eu boto mais a porta n abri quando eu uso a chave.
Fez tudo certo? Colocou essa Tag no actions.xml:
<action itemid="IdDaChave" script="seuarquivo.lua" />
é o Action e Unique 23550 na Porta?
queria muito diser q n mais fiz sim
urruuuuuuuuuuuuuuuuuuuuuuuuuuuu achei fiz uma ganbiarra aq q deu certo vlw ae manim c ajudo mesmo ma, dei umas mexida no script botei uns codigo pronto que tinha aq de coisa q tinha nada a ver e funfo legal
é bom saber, Agora peça para que fechem o tópico.
Tópico movido para a seção de dúvidas e pedidos resolvidos.
Alguns dos meus trabalhos no fórum
Projeto Tutores de Scripting (encerrado)
Evento Blood Castle Automático
Killua Task System
Killua Automatic Raids System
Função AccountStorageValue
Player Pull Action (puxar jogador)
NPC Trocador - Troca itens por outros (SIMPLIFICADO)
Teleportar Membros Da Guild Para Seu Lado
Itens Ganhando Exp e Upando (Upgrade System)
Como usar addEvent - Tutorial
Sistema de Cultivo (Plantação)
Cart System (Andar de carrinho)