TH

Npc Que Só Fala Com Premmy E Se Locomove Facilmente

Por thayam, 19 de set. de 2007 em NPCs, monsters e raids

script
14
2.2k
thayamT
19 de setembro de 2007 às 18:58

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

Editado Setembro 19 por thayam

DreniusD
19 de setembro de 2007 às 19:04

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_-=

thayamT
19 de setembro de 2007 às 19:09
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~~

1 mês depois...
deco20D
10 de outubro de 2007 às 11:29

vc é bom mesmo thayam =]

parabens ajudo muito agora =PP !

Cya

10 de outubro de 2007 às 11:41

Bom,

Curti

Bem feito e Bem explicado

Parabens...

thayamT
10 de outubro de 2007 às 13:36

//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

Editado Outubro 14 por thayam

3 semanas depois...
FerrysF
26 de outubro de 2007 às 13:34

muito bom isso

continua assim

 

:XTibia_smile:

3 meses depois...
Henrique99H
01 de janeiro de 2008 às 22:16

vlw aprovado

3 semanas depois...
thayamT
18 de janeiro de 2008 às 19:36

Vlw ai galera

DaNDaNrOxXD
24 de janeiro de 2008 às 23:43

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

mto legal vlw!!

maninhoM
26 de janeiro de 2008 às 04:31

muito bom!

meus parabens!

1 mês depois...
leandrocoreL
10 de fevereiro de 2008 às 14:02

:smile_positivo: otimo tuto parabens mais podia ter usado QUOTE

mais tudo bem

 

 

By DARk

 

:XTibia_smile:

12 de fevereiro de 2008 às 00:53

Gostei cara so falto um bom quote né :D

caiocesar2C
12 de fevereiro de 2008 às 01:21

daorinha :thumbsupsmiley: