Ir para conteúdo

Npc The Oracle By Kotz Pra 8.60 (Para 8.70 Tbm)


Kotz

Posts Recomendados

--oracle by kotz--

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

local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

if msgcontains(msg, 'yes') then

if(getPlayerLevel(cid)) >= 8 then

selfSay('WHAT PROFESSION HAVE YOU CHOSEN: KNIGHT, PALADIN, SORCERER, DRUID?', cid)

talkState[talkUser] = 3

else

selfSay('CHILD! COME BACK WHEN YOU HAVE GROWN UP!', cid)

end

playerpos = getPlayerPosition(cid)

city1 = {x=75, y=398, z=11}

city2 = {x=217, y=338, z=7}

elseif talkState[talkUser] == 3 then

if msgcontains(msg, 'knight') then

talkState[talkUser] = 4

selfSay('Para qual city voce deseja ir? city1 ou city2', cid)

else

if msgcontains(msg, 'paladin') then

talkState[talkUser] = 5

selfSay('Para qual city voce deseja ir? city1 ou city2', cid)

else

if msgcontains(msg, 'sorcerer') then

talkState[talkUser] = 6

selfSay('Para qual city voce deseja ir? city1 ou city2', cid)

else

if msgcontains(msg, 'druid') then

talkState[talkUser] = 7

selfSay('Para qual city voce deseja ir? city1 ou city2', cid)

end

end

end

end

elseif talkState[talkUser] == 4 then

if msgcontains(msg, 'city1') then

doPlayerSetVocation(cid, 4)

doPlayerSetTown(cid, 1)

doTeleportThing(cid,city1)

doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)

selfSay('SO BE IT!', cid)

else

if msgcontains(msg, 'city2') then

doPlayerSetVocation(cid, 4)

doPlayerSetTown(cid, 2)

doTeleportThing(cid,city2)

doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)

selfSay('SO BE IT!', cid)

end

end

elseif talkState[talkUser] == 5 then

if msgcontains(msg, 'city1') then

doPlayerSetVocation(cid, 3)

doTeleportThing(cid,city1)

doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)

selfSay('SO BE IT!', cid)

else

if msgcontains(msg, 'city2') then

doPlayerSetVocation(cid, 3)

doPlayerSetTown(cid, 2)

doTeleportThing(cid,city2)

doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)

selfSay('SO BE IT!', cid)

end

end

elseif talkState[talkUser] == 6 then

if msgcontains(msg, 'city1') then

doPlayerSetVocation(cid, 1)

doTeleportThing(cid,city1)

doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)

selfSay('SO BE IT!', cid)

else

if msgcontains(msg, 'city2') then

doPlayerSetVocation(cid, 1)

doPlayerSetTown(cid, 2)

doTeleportThing(cid,city2)

doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)

selfSay('SO BE IT!', cid)

end

end

elseif talkState[talkUser] == 7 then

if msgcontains(msg, 'city1') then

doPlayerSetVocation(cid, 2)

doTeleportThing(cid,city1)

doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)

selfSay('SO BE IT!', cid)

else

if msgcontains(msg, 'city2') then

doPlayerSetVocation(cid, 2)

doPlayerSetTown(cid, 2)

doTeleportThing(cid,city2)

doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)

selfSay('SO BE IT!', cid)

end

end

return true

end

end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

<npc name="The Oracle" script="data/npc/scripts/oracle.lua" walkinterval="0" floorchange="0">

<health now="150" max="150"/>

<look typeex="1448"/>

<parameters>

<parameter key="message_greet" value="|PLAYERNAME|, ARE YOU PREPARED O FACE YOUR DESTINY?"/>

</parameters></npc>

 

Ta ai o The oracle feito por mim :D ta facinho de configurar:

 

city1 = {x=75, y=398, z=11}

city2 = {x=217, y=338, z=7} -- Aqui você poem as cordenadas e os nomes das citys (se mudar ali, não esqueça de mudar no resto do script) que o "the oracle" ira mandar o player, pra adicionar mais é só seguir a sequência.

 

Em verdiinho é as falas do npc "the oracle"

Em roxo é o id da vocation do player (voce checa isto na pasta xml/vocations.xml)

E por último nao menos importante, em marrom é o id da city pra que quando o player morra volte na city que ele escolheu.

 

Eu não puis cores no script todo, porque ia virar um carnaval, mas axo que da pra intender bem.

É isso ai qualquer problema reporte pra mim.

Editado por Kotz
Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...