Ir para conteúdo

Npc Que Só Fala Com Premmy E Se Locomove Facilmente


thayam

Posts Recomendados

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 por thayam
Link para o comentário
Compartilhar em outros sites

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

Link para o comentário
Compartilhar em outros sites

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

Link para o comentário
Compartilhar em outros sites

  • 3 weeks later...
  • 3 weeks later...
  • 2 months later...
  • 3 weeks later...
  • 3 weeks later...
×
×
  • Criar Novo...