Crie um novo arquivo na sua pasta data\npc\scripts chamado oracle.lua e cole isso dentro:
-- Npc by Shrimpzin ^^local focus = 0
local talk_start = 0
local target = 0
local following = false
local attacking = false
function onThingMove(creature, thing, oldpos, oldstackpos)
end
function onCreatureAppear(creature)
end
function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('COME BACK WHEN YOU ARE PREPARED TO FACE YOUR DESTINY!')
focus = 0
talk_start = 0
end
end
function onCreatureTurn(creature)
end
function msgcontains(txt, str)
return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end
function onCreatureSay(cid, type, msg)
msg = string.lower(msg)
-- greeting phrase
if string.find(msg, '(%a*)hi(%a*)') and focus == 0 and string.len(msg) == 2 and getDistanceToCreature(cid) < 4 then
selfSay('' .. creatureGetName(cid) .. ', ARE YOU PREPARED TO FACE YOUR DESTINY?')
focus = cid
talk_start = os.clock()
elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('WAIT, I WILL TELL YOU A MOMENT!')
elseif focus == cid then
talk_start = os.clock()
if msgcontains(msg, 'yes') and talk_state ~= 458 then
if getPlayerLevel(cid) >= 8 then
selfSay('WHAT PROFESSION HAVE YOU CHOSEN: KNIGHT, PALADIN, SORCERER, OR DRUID?')
talk_state = 459
else
selfSay('CHILD! COME BACK WHEN YOU HAVE GROWN UP!')
talk_state = 0
end
elseif msgcontains(msg, 'no') then
selfSay('COME BACK WHEN YOU ARE PREPARED TO FACE YOUR DESTINY!')
talk_state = 0
elseif talk_state == 459 then
vocationid = 0
talk_state = 458
if msgcontains(msg, 'sorcerer') then
selfSay('A SORCERER! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!')
vocationid = 1
elseif msgcontains(msg, 'knight') then
selfSay('A KNIGHT! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!')
vocationid = 4
elseif msgcontains(msg, 'paladin') then
selfSay('A PALADIN! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!')
vocationid = 3
elseif msgcontains(msg, 'druid') then
selfSay('A DRUID! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!')
vocationid = 2
else
selfSay('KNIGHT, PALADIN, SORCERER, OR DRUID?')
talk_state = 459
end
elseif talk_state == 458 then
if msgcontains(msg, 'yes') then
selfSay('IN WHICH CITY YOU WANT TO LIVE: (cidade 1), (cidade 2), (cidade 3) OR (cidade 4)?')
talk_state = 452
else
selfSay((cidade 1), (cidade 2), (cidade 3) OR (cidade 4)?')
talk_state = 459
end
elseif talk_state == 452 then
if msgcontains(msg, 'cidade 1') then
doPlayerSetVocation(cid,vocationid)
doPlayerSetTown(cid,1) -- ID da cidade 1
selfSay('SO BE IT!')
doTeleportPlayer(cid,posx,posy,posz,1)
end
elseif talk_state == 452 then
if msgcontains(msg, 'cidade 2') then
doPlayerSetVocation(cid,vocationid)
doPlayerSetTown(cid,2) -- ID da cidade 2
selfSay('SO BE IT!')
doTeleportPlayer(cid,posx,posy,posz,1)
end
elseif talk_state == 452 then
if msgcontains(msg, 'cidade 3') then
doPlayerSetVocation(cid,vocationid)
doPlayerSetTown(cid,3) -- ID da cidade 3
selfSay('SO BE IT!')
doTeleportPlayer(cid,posx,posy,posz,1)
end
elseif talk_state == 452 then
if msgcontains(msg, 'cidade 4') then
doPlayerSetVocation(cid,vocationid)
doPlayerSetTown(cid,4) -- ID da cidade 4
selfSay('SO BE IT!')
doTeleportPlayer(cid,posx,posy,posz,1)
end
talk_state = 0
talk_start = 0
elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
selfSay('COME BACK WHEN YOU ARE PREPARED TO FACE YOUR DESTINY!')
focus = 0
talk_start = 0
end
end
end
function onCreatureChangeOutfit(creature)
end
function onThink()
if (os.clock() - talk_start) > 30 then
if focus > 0 then
selfSay('COME BACK WHEN YOU ARE PREPARED TO FACE YOUR DESTINY!')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Good bye then.')
focus = 0
end
end
end
O que está em vermelho é o nome das cidades que terá no seu OT
O que está em verde é o ID da cidade, veja no seu map editor
O que está em azul é a posição da cidade, em ordem: x, y, z e stackpos (deixe sempre 1 se não sabe usá-lo)
Não mexa nas falas se quiser um igual ao do Tibia
Crie um arquivo na pasta data\npc chamado oracle.xml e escreva isso:
<?xml version="1.0"?>
<npc name="The Oracle" script="data/npc/scripts/oracle.lua" access="3">
<look typeex="1448" corpse="3128"/>
</npc>
E está pronto. Se não quizer dar /s todas as vezes que abrir o OT, cole isto no seu creatures.xml:
<creature itemid="1448" name="The Oracle" type="npc"/>
OBS: Funciona em 7.80, 7.81, 7.90, 7.92 e 8.00;
OBS2: Testado em Zorzin e DevLand
OBS3: Coloquei em quotes porque precisava de cores;
OBS4: Se for usado o Jiddo System, não vai funcionar;
OBS5: Recomendado para uso em Zorzin ou servidores com o Sistema de Compra/Venda dele.