area errada, vou mover
presta mais atenção onde posta
info
Grupo: Herói
Registrado: 20/05/10
Posts: 3.4k
Reputação: +1.5k
Gênero: Masculino

area errada, vou mover
presta mais atenção onde posta
Ok, desculpe.
Mas tem como você me ajudar? ![]()
tenta assim:
local focus = 0
local talk_start = 0
local target = 0
local following = false
local attacking = false
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, text)
local msg = string.lower(text)
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()
if not isCreature(focus) then focus = 0 selfSay("Quem é o próximo?") return end
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
não deu... ele ainda fica como se tivesse falando com o jogador...
alguem me ajuda porfavor???
Tenta assim:
local focus = 0
local talk_start = 0
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, text)
local msg = string.lower(text)
if msgcontains(msg, 'hi') and (focus == 0) and getDistanceToCreature(cid) < 4 then
selfSay('Hello ' .. getCreatureName(cid) .. '! Voce quer ir para a quest?')
focus = cid
talk_start = os.clock()
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 = os.clock()
end
end
end
function onThink()
if focus == 0 then return true end
if not isCreature(focus) then focus = 0 selfSay("Próximo por favor...") return true end
doNpcSetCreatureFocus(focus)
if getDistanceToCreature(focus) > 30 then
selfSay('Próximo por favor...')
focus = 0
end
end
ainda nao ![]()
dá algum erro?
o player morre e como fica as respostas do npc?
continua cmo se ele estivesse falando com o player...
ja no emulador da erro...

Editado Setembro 25 por lordrai
Tenta assim então:
local focus = 0
local talk_start = 0
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, text)
local msg = string.lower(text)
if msgcontains(msg, 'hi') and (focus == 0) and getDistanceToCreature(cid) < 4 then
selfSay('Hello ' .. getCreatureName(cid) .. '! Voce quer ir para a quest?')
focus = cid
talk_start = os.clock()
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 = os.clock()
end
end
end
function onThink()
if focus == 0 then return true end
if not isCreature(focus) then focus = 0 selfSay("Próximo por favor...") return true end
doNpcSetCreatureFocus(focus)
if not getDistanceToCreature(focus) or getDistanceToCreature(focus) > 30 then
selfSay('Próximo por favor...')
focus = 0
end
end
info
Grupo: Campones
Registrado: 17/12/07
Posts: 32
Reputação: -1
Char no Tibia: aienbdn
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: