Ir para conteúdo
  • 0

[Duvida] Urgente Npc De Teleport Para Quest


Pergunta

Eu queria fazer um npc que teletransportasse para uma quest

porém só poderia ir um jogador de uma vez... o que eu fiz, quando ele se teletransporta ele continua conversando com o npc... porem quando ele pega o teleport da quest ele vai para mais longe e assim o npc diz tchau.

 

porém há um erro... quando o player morre lá... o npc fica como se ainda tivesse falando com ele...

e assim começa a dar erro também no emulador

 

 

Queria saber como eu faço para quando um player morrer ele dizer tchau?

 

 

NPC:

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('Good bye then.')

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)

 

if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then

if getPlayerAccess(cid) >= 0 then

selfSay('Hello ' .. getCreatureName(cid) .. '! Voce quer ir para a quest?')

focus = cid

talk_start = os.clock()

else

selfSay('Wait')

focus = 0

talk_start = 0

end

 

elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then

selfSay('Desculpe, ' .. getCreatureName(cid) .. '!Somente 1 por vez na quest, aguarde sua vez.')

 

elseif focus == cid then

talk_start = os.clock()

 

if msgcontains(msg, 'yes') then

if pay(cid,0) then

travel(cid, 876, 51, 0)

selfSay('Que o poder saiyajin esteja com voce!')

 

else

selfSay('Sorry, you don\'t have enough money.')

end

 

 

 

 

elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then

selfSay('Good bye, ' .. getCreatureName(cid) .. '!')

focus = 0

talk_start = 0

end

end

end

 

function onThink()

doNpcSetCreatureFocus(focus)

if (os.clock() - talk_start) > 45000000 then

if focus > 0 then

selfSay('Proximo porfavor...')

end

focus = 0

end

if focus ~= 0 then

if getDistanceToCreature(focus) > 30 then

selfSay('Proximo porfavor...')

focus = 0

end

end

end

 

Link para o comentário
https://xtibia.com/forum/topic/194946-duvida-urgente-npc-de-teleport-para-quest/
Compartilhar em outros sites

0 respostass a esta questão

Posts Recomendados

Até agora não há respostas para essa pergunta

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...