Northon 3 Postado Julho 1, 2008 Share Postado Julho 1, 2008 (editado) [Npc] Vendedor de Loot Abra a pasta: data/npc/scripts Copie qualquer arquivo e renomei por isso: Lootbuy.lua Acesse-o e cole isso: local focus = 0 local 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('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 ' .. getCreatureName(cid) .. '! Eu vendo swords, clubs, axes,legs, shields e armors.') focus = cid talk_start = os.clock() elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then selfSay('Sorry, ' .. getCreatureName(cid) .. '! Espere um minuto.') elseif focus == cid then talk_start = os.clock() if msgcontains(msg, 'mystic turban') then sell(cid,2663,getCount(msg),500) elseif msgcontains(msg, 'steel helmet') then buy(cid,2457,getCount(msg),1200) elseif msgcontains(msg, 'chain helmet') then buy(cid,2458,getCount(msg),150) elseif msgcontains(msg, 'brass helmet') then buy(cid,2460,getCount(msg),90) elseif msgcontains(msg, 'studded helmet') then buy(cid,2482,getCount(msg),40) elseif msgcontains(msg, 'helmets') then selfSay('Eu vendo chain helmet (150gp), steel helmet (1200gp),brass helmet (90gp) e studded helmet (40gp).') elseif msgcontains(msg, 'mammoth fur cape') then buy(cid,7463,getCount(msg),6000) elseif msgcontains(msg, 'plate armor') then buy(cid,2463,getCount(msg),800) elseif msgcontains(msg, 'brass armor') then buy(cid,2465,getCount(msg),400) elseif msgcontains(msg, 'chain armor') then buy(cid,2464,getCount(msg),150) elseif msgcontains(msg, 'armors') then selfSay('Eu vendo plate (800gp), brass (400gp) and chain armors (150gp), tambem mammoth fur cape (6k).') elseif msgcontains(msg, 'brass legs') then buy(cid,2478,getCount(msg),200) elseif msgcontains(msg, 'chain legs') then buy(cid,2478,getCount(msg),100) elseif msgcontains(msg, 'legs') then selfSay('Eu vendo brass (200gp) and chain legs (100gp).') elseif msgcontains(msg, 'steel shield') then buy(cid,2511,getCount(msg),180) elseif msgcontains(msg, 'plate shield') then buy(cid,2510,getCount(msg),145) elseif msgcontains(msg, 'dwarven shield') then buy(cid,2525,getCount(msg),300) elseif msgcontains(msg, 'shields') then selfSay('Eu vendo plate (145gp),steel (180gp) and dwarven shields (300gp).') elseif msgcontains(msg, 'serpent sword') then buy(cid,2409,getCount(msg),3500) elseif msgcontains(msg, 'spike sword') then buy(cid,2383,getCount(msg),2800) elseif msgcontains(msg, 'two handed sword') then buy(cid,2377,getCount(msg),2400) elseif msgcontains(msg, 'swords') then selfSay('Eu vendo serpent (3.5k), spike (2.8k) and two handed swords (2.4k).') elseif msgcontains(msg, 'double axe') then buy(cid,2387,getCount(msg),2200) elseif msgcontains(msg, 'halberd') then buy(cid,2381,getCount(msg),2400) elseif msgcontains(msg, 'battle axe') then buy(cid,2378,getCount(msg),200) elseif msgcontains(msg, 'hatchet') then buy(cid,2388,getCount(msg),60) elseif msgcontains(msg, 'beastslayer axe') then buy(cid,3962,getCount(msg),7000) elseif msgcontains(msg, 'barbarian axe') then buy(cid,2429,getCount(msg),1800) elseif msgcontains(msg, 'axes') then selfSay('Eu vendo double (2.2k), beastslayer axe (6k), barbarian (1.8k) halberds (2.4k) e hatchets (60gp).') elseif msgcontains(msg, 'clerical mace') then buy(cid,2423,getCount(msg),1200) elseif msgcontains(msg, 'battle hammer') then buy(cid,2417,getCount(msg),900) elseif msgcontains(msg, 'mace') then buy(cid,2398,getCount(msg),90) elseif msgcontains(msg, 'dragonbone staff') then buy(cid,7430,getCount(msg),5800) elseif msgcontains(msg, 'clubs') then selfSay('Eu vendo battle hammers (900gp), dragonbone staff (5.8k) e clerical maces (1.2k).') elseif msgcontains(msg, 'scarf') then buy(cid,2661,getCount(msg),1000) elseif msgcontains(msg, 'amulets') then selfSay('Eu vendo scarf (1k).') elseif string.find(msg, '(%a*)bye(%a*)') and getDistanceToCreature(cid) < 4 then selfSay('Tchau, Tchau, ' .. getCreatureName(cid) .. '!') 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('...') end focus = 0 end if focus ~= 0 then if getDistanceToCreature(focus) > 5 then selfSay('...') focus = 0 end end end Vá em arquivo -> salvar. Acesse a pasta: data/npc Copie qualquer npc e renomeio para Vendedor de Loot. Abra o arquivo e cole isso: <?xml version="1.0"?> <npc name="Vendedor de Loot" script="data/npc/scripts/Lootbuy.lua" access="3" lookdir="2" autowalk="25"> <mana now="800" max="800"/> <health now="200" max="200"/> <look type="251" head="0" body="114" legs="96" feet="76" addons="3"/> </npc> Pronto!, salve o arquivo. Créditos: Thyrania pelo script e Northon pelo tutorial. Editado Julho 1, 2008 por Northon Link para o comentário https://xtibia.com/forum/topic/89395-npc-vendedor-de-loot/ Compartilhar em outros sites More sharing options...
sebas182 0 Postado Julho 1, 2008 Share Postado Julho 1, 2008 legal, modifiquei algumas coisinhas pra por no meu NPC de rook! ah, você sabe como fazer um NPC que modifica seu outfit? Link para o comentário https://xtibia.com/forum/topic/89395-npc-vendedor-de-loot/#findComment-568256 Compartilhar em outros sites More sharing options...
Northon 3 Postado Julho 1, 2008 Autor Share Postado Julho 1, 2008 Não sei, mais vou proucurar saber, ai eu te mando. Link para o comentário https://xtibia.com/forum/topic/89395-npc-vendedor-de-loot/#findComment-568268 Compartilhar em outros sites More sharing options...
manirao 0 Postado Julho 15, 2008 Share Postado Julho 15, 2008 Ficou Mto Bom Seu Script E Tals Parabens!!!! Link para o comentário https://xtibia.com/forum/topic/89395-npc-vendedor-de-loot/#findComment-579357 Compartilhar em outros sites More sharing options...
dudu2530 2 Postado Julho 15, 2008 Share Postado Julho 15, 2008 bom seu script testei a aprovei aprovado.. Link para o comentário https://xtibia.com/forum/topic/89395-npc-vendedor-de-loot/#findComment-579429 Compartilhar em outros sites More sharing options...
Posts Recomendados