thayam 0 Postado Setembro 19, 2007 Share Postado Setembro 19, 2007 (editado) 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, 2007 por thayam Link para o comentário https://xtibia.com/forum/topic/63376-npc-que-s%C3%B3-fala-com-premmy-e-se-locomove-facilmente/ Compartilhar em outros sites More sharing options...
Drenius 0 Postado Setembro 19, 2007 Share Postado Setembro 19, 2007 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 , 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 https://xtibia.com/forum/topic/63376-npc-que-s%C3%B3-fala-com-premmy-e-se-locomove-facilmente/#findComment-386649 Compartilhar em outros sites More sharing options...
thayam 0 Postado Setembro 19, 2007 Autor Share Postado Setembro 19, 2007 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 , 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 https://xtibia.com/forum/topic/63376-npc-que-s%C3%B3-fala-com-premmy-e-se-locomove-facilmente/#findComment-386658 Compartilhar em outros sites More sharing options...
deco20 0 Postado Outubro 10, 2007 Share Postado Outubro 10, 2007 vc é bom mesmo thayam =] parabens ajudo muito agora =PP ! Cya Link para o comentário https://xtibia.com/forum/topic/63376-npc-que-s%C3%B3-fala-com-premmy-e-se-locomove-facilmente/#findComment-400381 Compartilhar em outros sites More sharing options...
SirAlquati 0 Postado Outubro 10, 2007 Share Postado Outubro 10, 2007 Bom, Curti Bem feito e Bem explicado Parabens... Link para o comentário https://xtibia.com/forum/topic/63376-npc-que-s%C3%B3-fala-com-premmy-e-se-locomove-facilmente/#findComment-400389 Compartilhar em outros sites More sharing options...
thayam 0 Postado Outubro 10, 2007 Autor Share Postado Outubro 10, 2007 (editado) //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, 2007 por thayam Link para o comentário https://xtibia.com/forum/topic/63376-npc-que-s%C3%B3-fala-com-premmy-e-se-locomove-facilmente/#findComment-400481 Compartilhar em outros sites More sharing options...
Ferrys 0 Postado Outubro 26, 2007 Share Postado Outubro 26, 2007 muito bom isso continua assim :XTibia_smile: Link para o comentário https://xtibia.com/forum/topic/63376-npc-que-s%C3%B3-fala-com-premmy-e-se-locomove-facilmente/#findComment-411619 Compartilhar em outros sites More sharing options...
Henrique99 0 Postado Janeiro 2, 2008 Share Postado Janeiro 2, 2008 vlw aprovado Link para o comentário https://xtibia.com/forum/topic/63376-npc-que-s%C3%B3-fala-com-premmy-e-se-locomove-facilmente/#findComment-453938 Compartilhar em outros sites More sharing options...
thayam 0 Postado Janeiro 18, 2008 Autor Share Postado Janeiro 18, 2008 Vlw ai galera Link para o comentário https://xtibia.com/forum/topic/63376-npc-que-s%C3%B3-fala-com-premmy-e-se-locomove-facilmente/#findComment-463733 Compartilhar em outros sites More sharing options...
DaNDaNrOxX 15 Postado Janeiro 25, 2008 Share Postado Janeiro 25, 2008 Gostei do tuto mano mas usa QUOTE da próxima vez que fica bem mas facil pra quem vai usar mto legal vlw!! Link para o comentário https://xtibia.com/forum/topic/63376-npc-que-s%C3%B3-fala-com-premmy-e-se-locomove-facilmente/#findComment-467461 Compartilhar em outros sites More sharing options...
maninho 0 Postado Janeiro 26, 2008 Share Postado Janeiro 26, 2008 muito bom! meus parabens! Link para o comentário https://xtibia.com/forum/topic/63376-npc-que-s%C3%B3-fala-com-premmy-e-se-locomove-facilmente/#findComment-468067 Compartilhar em outros sites More sharing options...
leandrocore 0 Postado Fevereiro 10, 2008 Share Postado Fevereiro 10, 2008 :smile_positivo: otimo tuto parabens mais podia ter usado QUOTE mais tudo bem By DARk :XTibia_smile: Link para o comentário https://xtibia.com/forum/topic/63376-npc-que-s%C3%B3-fala-com-premmy-e-se-locomove-facilmente/#findComment-478045 Compartilhar em outros sites More sharing options...
maximusot 1 Postado Fevereiro 12, 2008 Share Postado Fevereiro 12, 2008 Gostei cara so falto um bom quote né Link para o comentário https://xtibia.com/forum/topic/63376-npc-que-s%C3%B3-fala-com-premmy-e-se-locomove-facilmente/#findComment-479055 Compartilhar em outros sites More sharing options...
caiocesar2 3 Postado Fevereiro 12, 2008 Share Postado Fevereiro 12, 2008 daorinha Link para o comentário https://xtibia.com/forum/topic/63376-npc-que-s%C3%B3-fala-com-premmy-e-se-locomove-facilmente/#findComment-479066 Compartilhar em outros sites More sharing options...
Posts Recomendados