Npc Que Só Fala Com Premmy E Se Locomove Facilmente

thayam
Por thayam
em NPCs, monsters e raids

thayam

avatar
Cavaleiro
Cavaleiro

INFOS

Grupo: CavaleiroRegistrado: 02/11/05Posts: 179Char no Tibia: Dehby Dias, Hacked

Aew galera eu sei que tem otros topicos que ensinam como fazer npc andar... mas desse jeito que eu vou ensinar eh mais facil.

Eu nunk vi nenhum tutorial q ensinava igual vou ensinar. Lembrando que eh somente para 7.81+ esse tutorial

 

Vou pegar um npc de Aol que eh Muito Muito simples mesmo...

 

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('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

*** ***selfSay('Hello ' .. creatureGetName(cid) .. '! I sell scarfs (1k) and aols (40k).')

*** ***focus = cid

*** ***talk_start = os.clock()

 

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

*** ***selfSay('Sorry, ' .. creatureGetName(cid) .. '! I talk to you in a minute.')

 

*** elseif focus == cid then

***talk_start = os.clock()

 

***if msgcontains(msg, 'aol') then

*** buy(cid,2173,1,40000)

***elseif msgcontains(msg, 'scarf') then

*** buy(cid,2661,1,1000)

 

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

*** selfSay('Good bye, ' .. creatureGetName(cid) .. '!')

*** focus = 0

*** talk_start = 0

***end

*** end

end

 

 

function onCreatureChangeOutfit(creature)

 

end

 

 

function onThink()

 

if focus > 0 then ***

x, y, z = creatureGetPosition(focus)

myx, myy, myz = selfGetPosition()

if ((myy-y==0) and (myx-x<=0 and myx-x>=-4)) then

*** *** *** selfTurn(0)

end ***

if ((myy-y==0) and (myx-x>=0 and myx-x<=4)) then

*** *** *** selfTurn(2)

end

*** *** *** if ((myx-x==0) and (myy-y<=0 and myy-y>=-4)) then

*** *** *** selfTurn(1)

end

if ((myx-x==0) and (myy-y>=0 and myy-y<=4)) then

*** *** *** selfTurn(3)

end

if ((myy-y==-2) and (myx-x>=-1 and myx-x<=1)) then

*** *** *** selfTurn(1)

end

if ((myy-y==2) and (myx-x>=-1 and myx-x<=1)) then

*** *** *** ***selfTurn(3)

end

if ((myx-x==2) and (myy-y>=-1 and myy-y<=1)) then

*** *** *** ***selfTurn(2)

end

if ((myx-x==-2) and (myy-y>=-1 and myy-y<=1)) then

*** *** *** ***selfTurn(0)

end

if ((myy-y==-3) and (myx-x>=-2 and myx-x<=2)) then

*** *** *** ***selfTurn(1)

end

if ((myy-y==3) and (myx-x>=-2 and myx-x<=2)) then

*** *** *** ***selfTurn(3)

end

if ((myx-x==3) and (myy-y>=-2 and myy-y<=2)) then

*** *** *** ***selfTurn(2)

end

if ((myx-x==-3) and (myy-y>=-2 and myy-y<=2)) then

*** *** *** ***selfTurn(0)

end

if ((myy-y==-4) and (myx-x>=-3 and myx-x<=3)) then

*** *** *** ***selfTurn(1)

end

if ((myy-y==4) and (myx-x>=-3 and myx-x<=3)) then

*** *** *** ***selfTurn(3)

end

if ((myx-x==4) and (myy-y>=-3 and myy-y<=3)) then

*** *** *** ***selfTurn(2)

end

if ((myx-x==-4) and (myy-y>=-3 and myy-y<=3)) then

*** *** *** ***selfTurn(0)

end

end

 

*** if (os.clock() - talk_start) > 30 then

*** ***if focus > 0 then

*** *** selfSay('Next Please...')

*** ***end

*** focus = 0

*** end

***if focus ~= 0 then

*** if getDistanceToCreature(focus) > 5 then

*** ***selfSay('Good bye then.')

*** ***focus = 0

*** end

***end

end

Ate ai tudo bem... ai agora vcs vao procurar a funcao Onthink usem ctrl+f para axar, ela esta exatamente assim

Citação:

function onThink()

 

 

agora voces vao copiar e colar logo em baixo da linha do function onThink() o seguinte

 

if focus == 0 then

selfWalk(4)

end

 

e depois que voce colar isso essa parte ficara mais ou menos assim

 

function onThink()

if focus == 0 then ***

selfWalk(4) ***

end

e no final seu script acabara ficando assim

 

Citação:

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('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

*** ***selfSay('Hello ' .. creatureGetName(cid) .. '! I sell scarfs (1k) and aols (40k).')

*** ***focus = cid

*** ***talk_start = os.clock()

 

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

*** ***selfSay('Sorry, ' .. creatureGetName(cid) .. '! I talk to you in a minute.')

 

*** elseif focus == cid then

***talk_start = os.clock()

 

***if msgcontains(msg, 'aol') then

*** buy(cid,2173,1,40000)

***elseif msgcontains(msg, 'scarf') then

*** buy(cid,2661,1,1000)

 

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

*** selfSay('Good bye, ' .. creatureGetName(cid) .. '!')

*** focus = 0

*** talk_start = 0

***end

*** end

end

 

 

function onCreatureChangeOutfit(creature)

 

end

 

 

function onThink()

if focus == 0 then ***

selfWalk(4) ***

end

 

if focus > 0 then ***

x, y, z = creatureGetPosition(focus)

myx, myy, myz = selfGetPosition()

if ((myy-y==0) and (myx-x<=0 and myx-x>=-4)) then

*** *** *** selfTurn(0)

end ***

if ((myy-y==0) and (myx-x>=0 and myx-x<=4)) then

*** *** *** selfTurn(2)

end

*** *** *** if ((myx-x==0) and (myy-y<=0 and myy-y>=-4)) then

*** *** *** selfTurn(1)

end

if ((myx-x==0) and (myy-y>=0 and myy-y<=4)) then

*** *** *** selfTurn(3)

end

if ((myy-y==-2) and (myx-x>=-1 and myx-x<=1)) then

*** *** *** selfTurn(1)

end

if ((myy-y==2) and (myx-x>=-1 and myx-x<=1)) then

*** *** *** ***selfTurn(3)

end

if ((myx-x==2) and (myy-y>=-1 and myy-y<=1)) then

*** *** *** ***selfTurn(2)

end

if ((myx-x==-2) and (myy-y>=-1 and myy-y<=1)) then

*** *** *** ***selfTurn(0)

end

if ((myy-y==-3) and (myx-x>=-2 and myx-x<=2)) then

*** *** *** ***selfTurn(1)

end

if ((myy-y==3) and (myx-x>=-2 and myx-x<=2)) then

*** *** *** ***selfTurn(3)

end

if ((myx-x==3) and (myy-y>=-2 and myy-y<=2)) then

*** *** *** ***selfTurn(2)

end

if ((myx-x==-3) and (myy-y>=-2 and myy-y<=2)) then

*** *** *** ***selfTurn(0)

end

if ((myy-y==-4) and (myx-x>=-3 and myx-x<=3)) then

*** *** *** ***selfTurn(1)

end

if ((myy-y==4) and (myx-x>=-3 and myx-x<=3)) then

*** *** *** ***selfTurn(3)

end

if ((myx-x==4) and (myy-y>=-3 and myy-y<=3)) then

*** *** *** ***selfTurn(2)

end

if ((myx-x==-4) and (myy-y>=-3 and myy-y<=3)) then

*** *** *** ***selfTurn(0)

end

end

 

*** if (os.clock() - talk_start) > 30 then

*** ***if focus > 0 then

*** *** selfSay('Next Please...')

*** ***end

*** focus = 0

*** end

***if focus ~= 0 then

*** if getDistanceToCreature(focus) > 5 then

*** ***selfSay('Good bye then.')

*** ***focus = 0

*** end

***end

end

 

 

Agora eu vou ensinar como fazer um npc falar Somente com premmy account's... esse tutorial eu nunca vi aqui no forum.

Eh o seguinte vou fazer com o npc de Aol denovo pq ele eh muito simples.

Voce pega um npc de aol e ele vai estar mais ou menos assim

 

 

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('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

*** ***selfSay('Hello ' .. creatureGetName(cid) .. '! I sell scarfs (1k) and aols (40k).')

*** ***focus = cid

*** ***talk_start = os.clock()

 

*** elseif focus == cid then

***talk_start = os.clock()

 

***if msgcontains(msg, 'aol') then

*** buy(cid,2173,1,40000)

***elseif msgcontains(msg, 'scarf') then

*** buy(cid,2661,1,1000)

 

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

*** selfSay('Good bye, ' .. creatureGetName(cid) .. '!')

*** focus = 0

*** talk_start = 0

***end

*** end

end

 

 

function onCreatureChangeOutfit(creature)

 

end

 

 

function onThink()

if focus == 0 then ***

selfWalk(4) ***

end

 

if focus > 0 then ***

x, y, z = creatureGetPosition(focus)

myx, myy, myz = selfGetPosition()

if ((myy-y==0) and (myx-x<=0 and myx-x>=-4)) then

*** *** *** selfTurn(0)

end ***

if ((myy-y==0) and (myx-x>=0 and myx-x<=4)) then

*** *** *** selfTurn(2)

end

*** *** *** if ((myx-x==0) and (myy-y<=0 and myy-y>=-4)) then

*** *** *** selfTurn(1)

end

if ((myx-x==0) and (myy-y>=0 and myy-y<=4)) then

*** *** *** selfTurn(3)

end

if ((myy-y==-2) and (myx-x>=-1 and myx-x<=1)) then

*** *** *** selfTurn(1)

end

if ((myy-y==2) and (myx-x>=-1 and myx-x<=1)) then

*** *** *** ***selfTurn(3)

end

if ((myx-x==2) and (myy-y>=-1 and myy-y<=1)) then

*** *** *** ***selfTurn(2)

end

if ((myx-x==-2) and (myy-y>=-1 and myy-y<=1)) then

*** *** *** ***selfTurn(0)

end

if ((myy-y==-3) and (myx-x>=-2 and myx-x<=2)) then

*** *** *** ***selfTurn(1)

end

if ((myy-y==3) and (myx-x>=-2 and myx-x<=2)) then

*** *** *** ***selfTurn(3)

end

if ((myx-x==3) and (myy-y>=-2 and myy-y<=2)) then

*** *** *** ***selfTurn(2)

end

if ((myx-x==-3) and (myy-y>=-2 and myy-y<=2)) then

*** *** *** ***selfTurn(0)

end

if ((myy-y==-4) and (myx-x>=-3 and myx-x<=3)) then

*** *** *** ***selfTurn(1)

end

if ((myy-y==4) and (myx-x>=-3 and myx-x<=3)) then

*** *** *** ***selfTurn(3)

end

if ((myx-x==4) and (myy-y>=-3 and myy-y<=3)) then

*** *** *** ***selfTurn(2)

end

if ((myx-x==-4) and (myy-y>=-3 and myy-y<=3)) then

*** *** *** ***selfTurn(0)

end

end

 

*** if (os.clock() - talk_start) > 30 then

*** ***if focus > 0 then

*** *** selfSay('Next Please...')

*** ***end

*** focus = 0

*** end

***if focus ~= 0 then

*** if getDistanceToCreature(focus) > 5 then

*** ***selfSay('Good bye then.')

*** ***focus = 0

*** end

***end

end

 

 

Agora voces vao procurar essa parte aqui

 

 

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

*** ***selfSay('Hello ' .. creatureGetName(cid) .. '! I sell scarfs (1k) and aols (40k).')

*** ***focus = cid

*** ***talk_start = os.clock()

quando axarem essa parte voces vao colocar

 

if isPremium(cid) then

Bem embaixo de onde ta escrito

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

 

entao essa parte ira ficar mais ou menos assim

 

 

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

***if isPremium(cid) then

*** ***selfSay('Hello ' .. creatureGetName(cid) .. '! I sell scarfs (1k) and aols (40k).')

*** ***focus = cid

*** ***talk_start = os.clock()

agora ele so fala com premmy accounts, mais ainda falta um pekeno detalhe, voce tem q coloca logo em baixo do

talk_start = os.clock()

voces vao colocar isso daki

 

 

else

selfSay('Sai daki gentalha... So falo com Premmy accounts! .')

focus = 0

talk_start = 0

 

ficando assim esse script

 

Citação:

***

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

***if isPremium(cid) then

*** ***selfSay('Hello ' .. creatureGetName(cid) .. '! I sell scarfs (1k) and aols (40k).')

*** ***focus = cid

*** ***talk_start = os.clock()

else

*** selfSay('Sai daki gentalha... So falo com Premmy accounts! .')

*** focus = 0

*** talk_start = 0

end

 

 

 

Eh isso ai galera, kem gostou fala ai porque gostou e quem nao gostou fala ai tambem pq nao gostou =p

Drenius

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 20/07/07Posts: 42Char no Tibia: Edu Tabad (Hacked, Diyng)

Malukooooo, soh hj vc jah me ajudo umas 8 vzs, vei preciso conhece vc pessoalmente, vo solicita isso pro meu primo q tah cum um OT jah on lah dai ele jah vai atualizano :D , dps agente planeja se encontra por PM feito??

 

Mtu Bem Aprovado e Muito Bem Recomendado

 

Cara, n se atreva a sair do XTibia antes deu te conhece pessoalmente blz ?? xD

 

Abços, =-_DreniuS_-=

Sou:
Mapper: 100%
History Maker: 85%
Spell Maker: 80%
Scipter: 70%
Hoster: 80%
Monster Maker: 75%
House Maker: 95%

Sou:
Druid: 50%
Sorcerer: 70%
Palladin: 75%
Knight: 100%


Objetivos
{X}50 posts
{X}100 posts
{ }250 posts
{ }500 posts
{ }1000 posts`
{ } " " +
{X} Ter um tópico aprovado
{ } Ter um tópico FIXO

thayam

avatar
Cavaleiro
Cavaleiro

INFOS

Grupo: CavaleiroRegistrado: 02/11/05Posts: 179Char no Tibia: Dehby Dias, Hacked
Malukooooo, soh hj vc jah me ajudo umas 8 vzs, vei preciso conhece vc pessoalmente, vo solicita isso pro meu primo q tah cum um OT jah on lah dai ele jah vai atualizano :D , dps agente planeja se encontra por PM feito??

 

Mtu Bem Aprovado e Muito Bem Recomendado

 

Cara, n se atreva a sair do XTibia antes deu te conhece pessoalmente blz ?? xD

 

Abços, =-_DreniuS_-=

 

O kra pode cre vamu marca sim

Vlw pelos elogios ae

é sempre um prazer ajudar

kra minha fan bar ta saindo, assim que sai te mando uma PM avisando

flws abraços

Thayam~~

deco20

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 18/03/07Posts: 61Char no Tibia: Liokenn

vc é bom mesmo thayam =]

parabens ajudo muito agora =PP !

Cya

Olá XTibiano:

Sua assinatura estava com um problema na TAG SPOILER e foi movida para a parte "Sobre mim".
Agradecemos a sua compreensão.

Atenciosamente,
JV Chequer

SirAlquati

avatar
Barão
Barão

INFOS

Grupo: BarãoRegistrado: 16/01/07Posts: 206Char no Tibia: Thiago Shinoda

Bom,

Curti

Bem feito e Bem explicado

Parabens...


De volta ao Xtibia.

thayam

avatar
Cavaleiro
Cavaleiro

INFOS

Grupo: CavaleiroRegistrado: 02/11/05Posts: 179Char no Tibia: Dehby Dias, Hacked

//SirAlquati

 

Ae cara obrigado pelo elogio, assim que tiver um tempo, farei mais tutoriais para ajudar as pessoas aque do xtibia

 

//Deco20

Vlw ae kara

Ferrys

avatar
Artesão
Artesão

INFOS

Grupo: ArtesãoRegistrado: 10/10/07Posts: 110Char no Tibia: Ferrys

muito bom isso

continua assim

 

:XTibia_smile:

i love otserv (?)

thayam

avatar
Cavaleiro
Cavaleiro

INFOS

Grupo: CavaleiroRegistrado: 02/11/05Posts: 179Char no Tibia: Dehby Dias, Hacked

Vlw ai galera

DaNDaNrOxX

oi mosso
avatar
Marquês
Marquês

INFOS

Grupo: MarquêsRegistrado: 18/01/08Posts: 1455Char no Tibia: Saint Claire

Gostei do tuto mano mas usa QUOTE da próxima vez que fica bem mas facil pra quem vai usar :)

mto legal vlw!!

 

 

Entrada na equipe: 23/10/2008 Cargo: Estagiário

Promoção: 25/11/2008 Cargo: Moderador

Promoção: 21/10/2009 Cargo: Coordenador

Remoção: 09/05/2010 Motivo: Estudos

Retorno: 15/11/2010 Cargo: Moderador

Remoção: 20/12/2012.

 

 

maninho

Nada acabou, é apenas um novo começo.
avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 29/10/05Posts: 44Char no Tibia: Shedi Odio

muito bom!

meus parabens!

Atenciosamente Maninho ;)

Fan De:


Meu timão:

leandrocore

avatar
Artesão
Artesão

INFOS

Grupo: ArtesãoRegistrado: 01/12/07Posts: 127Gênero: Masculino

:smile_positivo: otimo tuto parabens mais podia ter usado QUOTE

mais tudo bem

 

 

By DARk

 

:XTibia_smile:

maximusot

avatar
Barão
Barão

INFOS

Grupo: BarãoRegistrado: 05/03/07Posts: 219

Gostei cara so falto um bom quote né :D



CLIQUE AKI DEPOIS CLIQUE NO CLICK AQUI DA SEGUNDA LINHA NÃO DEMORA NEM 1 MINUTO


MINHAS METAS

~~~~~~~~~~~~~~
~~
MINHAS METAS~~
~~~~~~~~~~~~~~


1 post (X)
10 posts (X)
20 posts (X)
30 posts (X)
40 posts (X)
50 posts (X)
60 posts (X)
70 posts (X)
80 posts (X)
90 posts (X)
100 posts (X)
120 posts (X)
150 posts (X)
200 posts (X)
300 posts (X)
400 posts (X)
500 posts (X)
600 posts (X)
700 posts (X)
800 posts (_)
900 posts (_)
1000 potsts (_)
1300 posts (_)
1500 posts (_)
1800 posts (_)
2000 posts (_)
----------------------------------------------------

MEUS TRABALHOS

caiocesar2

|.| Sou da época que Avatar era moda |.| ~ User Since 2005
avatar
Artesão
Artesão

INFOS

Grupo: ArtesãoRegistrado: 03/12/06Posts: 149Char no Tibia: Kanye Rusty

daorinha :thumbsupsmiley:

<< caiocesar2 >> Membro desde 2006 do Melhor Forum de Tibia e Otserver!

tyyyn.jpg

 

svjfjs.png

 

vemverfakejq6.gif

Celulares :

www.digivag.com.br