Olá Galera do XTibia e Visitantes desesperados
Vou postar aqui pra vocês um NPC "Tagarela"
Versões Testadas: 7.6, 7.8, 8.4.
Função: Dar noticias no seu Ot por Broadcast Message, e ainda te dá um presentinho se for sumonado.
Créditos: GM Look (50%) Laay (50%)
Sobre a criação: Eu encontrei isso no meu Ot 7.6 e começei a editar... Como estava dando certo e o pessoal adorando... Resolvi postar
Primeiro, vá na pasta NPC, crie um arquivo.xml (Tagarela) e coloque isso dentro:
<?xml version="1.0"?> <npc name="Tagarela" script="data/npc/scripts/tagarela.lua" access="3"> <look type="132" head="0" body="94" legs="94" feet="114"/> </npc>
Atenção: Esse NPC precisa ter acess 3+ para funcionar
Em Verde é o Looktype do seu NPC, pode mudar para outro...
Segundo, vá na pasta NPC > SCRIPTS, crie um arquivo.lua (Tagarela) e coloque isso dentro:
focus = 0 talk_start = 0 target = 0 following = false attacking = false function onThingMove(creature, thing, oldpos, oldstackpos) end function onCreatureAppear(creature) end function onCreatureDisappear(cid, pos) if focus == cid then selfSay('Olá!') 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 ((string.find(msg, '(%a*)hi(%a*)')) and (focus == 0)) and getDistanceToCreature(cid) < 4 then selfSay('Olá ' .. creatureGetName(cid) .. '!') focus = cid talk_start = os.clock() end if string.find(msg, '(%a*)hi(%a*)') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then selfSay('Espere..., ' .. creatureGetName(cid) .. '! Espere...') end if string.find(msg, '(%a*)Presentinho(%a*)') and focus == cid and getDistanceToCreature(cid) < 4 then present = getPlayerStorageValue(cid,1210) if present == -1 then buy(cid,item,1,0) setPlayerStorageValue(cid,1210,1) end if present == 1 then selfSay('O que? Mais Presentes? Meu trabalho é só falar >') end end if string.find(msg, '(%a*)bye(%a*)') and focus == cid and getDistanceToCreature(cid) < 4 then selfSay('Adeus, ' .. creatureGetName(cid) .. '!') focus = 0 talk_start = 0 end end function onCreatureChangeOutfit(creature) end function onThink() if (os.clock() - talk_start) > 30 then if focus > 0 then selfSay('Olá!') end focus = 0 end if focus ~= 0 then if getDistanceToCreature(focus) > 3 then selfSay('Olá!') focus = 0 end end if focus == 0 then cx, cy, cz = selfGetPosition() randmove = math.random(1,25) if randmove == 1 then nx = cx + 1 end if randmove == 2 then nx = cx - 1 end if randmove == 3 then ny = cy + 1 end if randmove == 4 then ny = cy - 1 end if randmove >= 5 then nx = cx ny = cy end moveToPosition(nx, ny, cz) --summons = 30 --summons2 = 30 end if focus > 0 then rand = math.random(1,6) if rand == 1 then item = 2969 elseif rand == 2 then item = 2973 elseif rand == 3 then item = 3363 elseif rand == 4 then item = 3520 elseif rand == 5 then item = 2930 else item = 3524 end end if focus == 0 then randsay = math.random(1,750) if randsay == 1 then selfSay('/B O que o NPC vai Falar aqui?') end if randsay == 2 then selfSay('/B O que o NPC vai Falar aqui?') end if randsay == 3 then selfSay('/B O que o NPC vai Falar aqui?') end if randsay == 4 then selfSay ('/B O que o NPC vai Falar aqui?') end if randsay == 5 then selfSay ('/B O que o NPC vai Falar aqui?') end if randsay == 6 then selfSay ('/B O que o NPC vai Falar aqui?') end if randsay == 7 then selfSay ('/B O que o NPC vai Falar aqui?') end if randsay == 8 then selfSay ('/B O que o NPC vai Falar aqui?') end if randsay == 9 then selfSay ('/B O que o NPC vai Falar aqui?') end if randsay == 10 then selfSay('/B O que o NPC vai Falar aqui?') end end end
Explicando: Em Verde, escreva o que o NPC vai ficar falando em Vermelho /b ou /B dependendo do OT
Se seu ot for /b para Broadcast message, apenas mude aquela parte em verde do ('/B O que o NPC vai Falar aqui?') para ('/b O que o NPC vai Falar aqui?') Faça isso em Todos
Quero adicionar mais Falas o que eu faço?
- Crie
if randsay == 11 then
selfSay('/B O que o NPC vai Falar aqui?')
E cole no script
Em vermelho: Quando for criar mais... coloque em ordem... 11,12,13,14... assim vai
Presente do Tagarela: Sumona o Tagarela e Diga Hi > presentinho
Espero que gostem.. Duvidas? Não tenha medo de perguntar!