npc/script
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
if msgcontains(msg, "destino") and getPlayerStorageValue(cid, oraculo) - 1 then
selfSay("Deseja começar? {sim}", cid)
talkState[cid] = 1
elseif msgcontains(msg, "destino") and getPlayerStorageValue(cid, oraculo) == 1 then
selfSay("Voce de novo, voce quer encarar seu destino?", cid)
talkState[cid] = 1
end
if msgcontains(msg, 'sim') and talkState[cid] == 0 and getPlayerLevel(cid) >= 250 then
selfSay("Entao voce quer sair desta salinha?", cid)
talkState[cid] = 1
else
if talkState[cid] == 250 and msgcontains(msg, 'sim') and getPlayerLevel(cid) < 250 then
selfSay("Voce acha q isso eh uma brincadeira? Volte quando estiver forte.", cid)
setPlayerStorageValue(cid, oraculo, 1)
return true
end
if msgcontains(msg, 'sim') and talkState[cid] == 1 then
selfSay("Tudo bem. Mas para ir para seguir o caminho voce tem que pegar a vocacao nova, {ok}?", cid)
talkState[cid] = 2
end
if msgcontains(msg, 'ok') and talkState[cid] == 2 then
selfSay("Otimo... Voce quer ser {promovido}?...", cid)
selfSay("...", cid)
talkState[cid] = 3
end
if msgcontains(msg, 'promovido') and talkState[cid] == 3 then
if isInArray({5,6,7,8}, getPlayerVocation(cid)) then
if(getPlayerMoney(cid) >= 100000) then
if getPlayerLevel(cid) > 100 then
doPlayerRemoveMoney(cid, 100000)
doPlayerSetVocation(cid, getPlayerVocation(cid)+4)
setPlayerStorageValue(cid, 45211, 1)
selfSay('Agora você possui a nova vocação!', cid)
else
selfSay('Voce nao tem level suficiente!', cid)
end
else
selfSay('Você não tem dinheiro!', cid)
end
else
selfSay('Voce precisa ser Bruxo, Elite Knight, Elder Druid ou Royal Paladin para ganhar a vocação nova!', cid)
end
if talkState[cid] == 8 or talkState[cid] == 9 or talkState[cid] == 10 or talkState[cid] == 11 then
selfSay("Otimo agora, que voce e um Elementalista, voce pode usar novas spells... {Ok}?", cid)
talkState[cid] = 12
end
if msgcontains(msg, "ok") and talkState[cid] == 12 then
selfSay("Voce terá de retornar a Hermes? {Cidade}", cid)
selfSay("Quer ir mesmo?", cid)
talkState[cid] = 13
end
if msgcontains(msg, "Cidade") and talkState[cid] == 13 then
selfSay("Você Será Movido Para Hermes City OK? {sim}", cid)
talkState[cid] = 14
elseif msgcontains(msg, "thaiszz") and talkState[cid] == 13 then
selfSay("Tem certeza q deseja {VIVER} em Thais?", cid)
talkState[cid] = 15
elseif msgcontains(msg, "venorezz") and talkState[cid] == 13 then
selfSay("Tem certeza q deseja {VIVER} em Venore?", cid)
talkState[cid] = 16
end
if msgcontains(msg, "sim") and talkState[cid] == 14 then
selfSay("Boa viagem e tome cuidado", cid)
doPlayerSetTown(cid, 2)-------------------------------------------------------ID da nova cidade (Conferido pelo map editor)
doTeleportThing(cid, {x=1017, y=1057, z=7, stackpos=253})-------------------coordenadas da nova cidade
doPlayerSendTextMessage(cid, 22,"Você Agora é Um Elementalista e Pode Usar Novas Magias!")
elseif msgcontains(msg, "sim") and talkState[cid] == 15 then
selfSay("Boa viagem e tome cuidado", cid)
doPlayerSetTown(cid, 5)-------------------------------------------------------ID da nova cidade (Conferido pelo map editor)
doTeleportThing(cid, {x=32369, y=32241, z=7, stackpos=253})-------------------coordenadas da nova cidade
doSendMagicEffect({x=32369, y=32241, z=7, stackpos=253}, 10)------------------coordenadas do efeito de teleporte
doPlayerSendTextMessage(cid, 22,"Bem vindo. Agora vc eh um cidadao de Thais")
elseif msgcontains(msg, "sim") and talkState[cid] == 16 then
selfSay("Boa viagem e tome cuidado", cid)
doPlayerSetTown(cid, 6)-------------------------------------------------------ID da nova cidade (Conferido pelo map editor)
doTeleportThing(cid, {x=32957, y=32076, z=7, stackpos=253})-------------------coordenadas da nova cidade
doSendMagicEffect({x=32957, y=32076, z=7, stackpos=253}, 10)------------------coordenadas do efeito de teleporte
doPlayerSendTextMessage(cid, 22,"Bem vindo. Agora vc eh um cidadao de Venore")
end
return true
end
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
npc:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="The Oracle" script="data/npc/scripts/promotion.lua" walkinterval="0" floorchange="0">
<health now="100" max="100"/>
<look typeex="1448"/>
<parameters>
<parameter key="message_greet" value="Hello |PLAYERNAME|! How can I {help} you?" />
<parameter key="module_keywords" value="1" />
<parameter key="keywords" value="help" />
<parameter key="keyword_reply1" value="I can give you the {first promotion} and {second promotion}." />
</parameters>
</npc>







info
Grupo: Artesão
Registrado: 01/08/10
Posts: 108
Reputação: 0
Char no Tibia: mylorc
[Resolvido]Olá,preciso de um npc que de as segundas profissões de perssonagens como master sorcer,elder druid,royal paladin,elite knight.
Alguém pode arrumar o npc para mim?
Obs:Para players lvl 250.
Editado Novembro 14 por mylorc