Olá gente, vim aqui compartilhar com vocês um script que eu fiz com muito suor.
• Função: Passar por uma porta somente se houver feito algumas quests, ou ações necessárias para avançar na mesma. Por exemplo: na Pits of Inferno há 7 Seals, e em cada um há um trono no final, ao subir no trono um script irá adicionar um Storage Values ao char. Completando-se todas as Seals irá haver 7 Storage Values diferentes registrados no devido char, então quando apertar na porta final da quest você será transportado para o outro lado dela, com o mesmo efeito da Level Door, porém, se caso ao contrário a pessoa não completar todas as Seals, irá aparecer esta devida mensagem ao tentar atravessar a porta: You are need complete all Seals..
data/actions/scripts/questdoor.lua
function onUse(cid, item, frompos, item2, topos)
if item.uid == 4058 then
status1 = getPlayerStorageValue(cid,4053)
status2 = getPlayerStorageValue(cid,4054)
status3 = getPlayerStorageValue(cid,4055)
status4 = getPlayerStorageValue(cid,4056)
status5 = getPlayerStorageValue(cid,4057)
if status1 == 1 then
if status2 == 1 then
if status3 == 1 then
if status4 == 1 then
if status5 == 1 then
end
end
end
pos = getPlayerPosition(cid)
if pos.x == topos.x then
if pos.y < topos.y then
pos.y = topos.y + 1
else
pos.y = topos.y - 1
end
elseif pos.y == topos.y then
if pos.x < topos.x then
pos.x = topos.x + 1
else
pos.x = topos.x - 1
end
else
doPlayerSendTextMessage(cid,24,'Stand in front of the door.')
return 1
end
doTeleportThing(cid,pos)
doSendMagicEffect(topos,12)
else
doPlayerSendTextMessage(cid,24,'You are need complete all Seals.')
end
return 1
else
return 0
end
end
end
Legenda:
█ - O UniqueID usada na porta.
█ - Storage necessário para abrir a porta.
█ - Mensagem quando não houver todas as Storages.
Como podem ver, no script só há 5 Storage Value, porém que quiser adicionar mais você terá que seguir esta ordem:
status1 = getPlayerStorageValue(cid,4053)status2 = getPlayerStorageValue(cid,4054)
status3 = getPlayerStorageValue(cid,4055)
status4 = getPlayerStorageValue(cid,4056)
status5 = getPlayerStorageValue(cid,4057)
status6 = getPlayerStorageValue(cid,4058)
if status1 == 1 then
if status2 == 1 then
if status3 == 1 then
if status4 == 1 then
if status5 == 1 then
if status6 == 1 then
Legenda:
█ - Tags novas adicionadas.
E assim por diante...
data/actions.xml
<action uniqueid="4058" script="questdoor.lua" />
Legenda:
█ - O UniqueID usada na porta.
Espero que tenham entendidos.
PS.1: Qualquer dúvida ou problemas observados avisem aqui, por favor.
Koninhoo~