Dartilus 3 Postado Março 28, 2008 Share Postado Março 28, 2008 Bom, eu criei este NPC pois estou meio cansado de todo mundo com a memsa backpack e bag... Então comecemos. Vá em data/npc, crie um arquivo xml com o nome "Olivier"...Dentro dele escreva: <?xml version="1.0"?> <npc name="Olivier" script="data/npc/scripts/backpack.lua" access="3" lookdir="2"> <mana now="800" max="800"/> <health now="200" max="200"/> <look type="132" head="23" body="114" legs="114" feet="114"/> </npc> Agora vá em data/npc/scripts, crie um arquivo lua com o nome "backpack"...Dentro dele escreva: local focus = 0local talk_start = 0 local target = 0 local following = false local attacking = false function onThingMove(creature, thing, oldpos, oldstackpos) end function onCreatureAppear(creature) end function onCreatureDisappear(cid, pos) if focus == cid then selfSay('Adeus.') 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) local msg = string.lower(msg) if msgcontains(msg, 'hi') and focus == 0 and getDistanceToCreature(cid) < 4 then selfSay('Ola ' .. getCreatureName(cid) .. '! Eu vendo backpacks e bags.') focus = cid talk_start = os.clock() elseif msgcontains(msg, 'hi') and focus ~= cid and getDistanceToCreature(cid) < 4 then selfSay('Desculpe, ' .. getCreatureName(cid) .. '! Eu ja falo com você.') elseif focus == cid then talk_start = os.clock() if msgcontains(msg, 'backpacks') then selfSay('Eu vendo poison backpack, solar backpack, fire backpack, roxeus backpack, water backpack, backpack of stone, orange backpack, star backpack, jungle backpack, pirate backpack, fury backpack, backpack of holding e backpack comum.Todas custam 100Gps.') elseif msgcontains(msg, 'bags') then selfSay('Temos a poison bag, solar bag, fire bag, roxeus bag, water bag, bag of stone. orange bag, star bag, jungle bag, pirate bag, fury bag e bag comum.Todas custam por 50 Gps.') elseif msgcontains(msg, 'backpack comum') then buy(cid,1988,1,100) elseif msgcontains(msg, 'poison backpack') then buy(cid,1998,1,100) elseif msgcontains(msg, 'solar backpack') then buy(cid,1999,1,100) elseif msgcontains(msg, 'fire backpack') then buy(cid,2000,1,100) elseif msgcontains(msg, 'roxeus backpack') then buy(cid,2001,1,100) elseif msgcontains(msg, 'water backpack') then buy(cid,2002,1,100) elseif msgcontains(msg, 'backpack of stone') then buy(cid,2003,1,100) elseif msgcontains(msg, 'orange backpack') then buy(cid,2004,1,100) elseif msgcontains(msg, 'jungle backpack') then buy(cid,3940,1,100) elseif msgcontains(msg, 'pirate backpack') then buy(cid,5926,1,100) elseif msgcontains(msg, 'fury backpack') then buy(cid,7342,1,100) elseif msgcontains(msg, 'backpack of holding') then buy(cid,2365,1,100) elseif msgcontains(msg, 'star backpack') then buy(cid,5949,1,100) elseif msgcontains(msg, 'bag comum') then buy(cid,1987,1,50) elseif msgcontains(msg, 'poison bag') then buy(cid,1991,1,50) elseif msgcontains(msg, 'solar bag') then buy(cid,1992,1,50) elseif msgcontains(msg, 'fire bag') then buy(cid,1993,1,50) elseif msgcontains(msg, 'roxeus bag') then buy(cid,1994,1,50) elseif msgcontains(msg, 'water bag') then buy(cid,1995,1,50) elseif msgcontains(msg, 'bag of stone') then buy(cid,1996,1,50) elseif msgcontains(msg, 'orange bag') then buy(cid,1997,1,50) elseif msgcontains(msg, 'jungle bag') then buy(cid,3939,1,50) elseif msgcontains(msg, 'pirate bag') then buy(cid,5927,1,50) elseif msgcontains(msg, 'fury bag') then buy(cid,7343,1,50) elseif msgcontains(msg, 'star bag') then buy(cid,5950,1,50) elseif string.find(msg, '(%a*)bye(%a*)') and getDistanceToCreature(cid) < 4 then selfSay('Adeus, ' .. getCreatureName(cid) .. ', obrigado e volte sempre!') focus = 0 talk_start = 0 end end end function onCreatureChangeOutfit(creature) end function onThink() if (os.clock() - talk_start) > 20 then if focus > 0 then selfSay('Proximo!') end focus = 0 end if focus ~= 0 then if getDistanceToCreature(focus) > 5 then selfSay('Proximo!') focus = 0 end end end Fiquem a vontade para editar o nome das backpacks e bags como eu fiz. SS: Espero que gostem... Atenciosamente, Dartilus Link para o comentário https://xtibia.com/forum/topic/80795-npc-vendedor-de-bag-e-backpack/ Compartilhar em outros sites More sharing options...
Twopac 1 Postado Abril 5, 2008 Share Postado Abril 5, 2008 Aq vc nao acha q as bag ta caro nao? 50 gp o/ e pirate bp e raro... Link para o comentário https://xtibia.com/forum/topic/80795-npc-vendedor-de-bag-e-backpack/#findComment-511422 Compartilhar em outros sites More sharing options...
XKronusX 0 Postado Abril 5, 2008 Share Postado Abril 5, 2008 Olha, é legal, mas para leigos dava para você tentar ser mais claro. As vezes o cara adora jogar ot mas é completamente inexperiente e quer fazer um ot. Será que ele sabe oque é um arquivo xml? Bom, não sei, mas, dexa keto Tirando isso, ta legal. @Twopac Preço você pode alterar da forma que quiser, então não importa realmente oque ele pois. Se não sabe alterar, pode pergunta tambem Abraço //Kronus Link para o comentário https://xtibia.com/forum/topic/80795-npc-vendedor-de-bag-e-backpack/#findComment-511476 Compartilhar em outros sites More sharing options...
Dartilus 3 Postado Abril 7, 2008 Autor Share Postado Abril 7, 2008 @Twopac A bag de pirate não é tão rara assim (pelo menos em Open Tibia Server não) pois é achada com facilidade em pirates. Eu usei preços de 50 e 100 apenas para dar um exemplo, modifique se desejar assim... @XKronusX É bastante provavel que qualquer um que tenha procurado por NPCs e Monsters nesta area já tenha ideia do que é xml.Tenho certeza de que quem tiver duvida ira ficar feliz em procurar em outras seções. Já pensou se todos que forem criar tutoriais ou mostrar seus npcs/actions/monsters precisem explicar o que é xml? As vezes o cara adora jogar ot mas é completamente inexperiente e quer fazer um ot. A seção de tutoriais para começar com um OTServ serve justamente para isto.Tenho certeza que a maioria dos iniciantes que chegam aqui no XTibia, olhão a seção de tutoriais e encontram o sub-forum "Começando seu OTServ". Obrigado ambos pelos comentários. Atenciosamente, Dartilus Link para o comentário https://xtibia.com/forum/topic/80795-npc-vendedor-de-bag-e-backpack/#findComment-512358 Compartilhar em outros sites More sharing options...
jugerson 0 Postado Abril 9, 2008 Share Postado Abril 9, 2008 caraeu fis serto boto o respaw no mapeditor mas quando vou jogar ele n ta mais la =/ sabe como arrumo isso ? alguem ajuda ai plx Link para o comentário https://xtibia.com/forum/topic/80795-npc-vendedor-de-bag-e-backpack/#findComment-513648 Compartilhar em outros sites More sharing options...
Posts Recomendados