MarcellooC2 0 #1 Posted July 30, 2008 (edited) Ae galera !! To postando o meu 1º tópico, eu mesmo fiz esse NPC. Se ja existe um npc assim. plx apague. Procurei pelo site e n axei um npc assim. É o Npc Mordomo. ele vende tudo de graça, aol, bp de varias cores, runas, wands, rods, potions..... xega de papo. vamos ao script. --NPC Mordomo by MarcelloC2-- 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('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) msg = string.lower(msg) if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then selfSay('Olá ' .. creatureGetName(cid) .. '! Sou um mordomo. E so vc pedir que eu dou! Aol, Bps, Runes, Wands, Rods, Potions, Kits de Ksa .') focus = cid talk_start = os.clock() elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then selfSay('Desculpe, ' .. creatureGetName(cid) .. '! Falo com vc em um minuto.') elseif focus == cid then talk_start = os.clock() if msgcontains(msg, 'wooden chair') then buy(cid,3901,getCount(msg),0) elseif msgcontains(msg, 'sofa chair') then buy(cid,3902,getCount(msg),0) elseif msgcontains(msg, 'red cushioned chair') then buy(cid,3903,getCount(msg),0) elseif msgcontains(msg, 'green cushioned chair') then buy(cid,3904,getCount(msg),0) elseif msgcontains(msg, 'tusk chair') then buy(cid,3905,getCount(msg),0) elseif msgcontains(msg, 'ivory chair') then buy(cid,3906,getCount(msg),0) elseif msgcontains(msg, 'chairs') then selfSay('Cadeiras? Tenho: wooden, sofa, red cushioned, green cushioned, tusk and ivory chairs.') elseif msgcontains(msg, 'big table') then buy(cid,3909,getCount(msg),0) elseif msgcontains(msg, 'square table') then buy(cid,3910,getCount(msg),0) elseif msgcontains(msg, 'round table') then buy(cid,3911,getCount(msg),0) elseif msgcontains(msg, 'small table') then buy(cid,3912,getCount(msg),0) elseif msgcontains(msg, 'stone table') then buy(cid,3913,getCount(msg),0) elseif msgcontains(msg, 'tusk table') then buy(cid,3914,getCount(msg),0) elseif msgcontains(msg, 'bamboo table') then buy(cid,3919,getCount(msg),0) elseif msgcontains(msg, 'tables') then selfSay('Mesas? Tenho: big, square, round, small, stone, tusk, bamboo tables.') elseif msgcontains(msg, 'pink flower') then buy(cid,3928,getCount(msg),0) elseif msgcontains(msg, 'green flower') then buy(cid,3929,getCount(msg),0) elseif msgcontains(msg, 'christmas tree') then buy(cid,3931,getCount(msg),0) elseif msgcontains(msg, 'plants') then selfSay('Flores? Tenho: pink and green flowers, also christmas trees.') elseif msgcontains(msg, 'large trunk') then buy(cid,3938,getCount(msg),0) elseif msgcontains(msg, 'drawer') then buy(cid,3921,getCount(msg),0) elseif msgcontains(msg, 'dresser') then buy(cid,3932,getCount(msg),0) elseif msgcontains(msg, 'locker') then buy(cid,3934,getCount(msg),0) elseif msgcontains(msg, 'trough') then buy(cid,3935,getCount(msg),0) elseif msgcontains(msg, 'box') then buy(cid,3915,getCount(msg),0) elseif msgcontains(msg, 'containers') then selfSay('Containers? Tenho: large trunks, boxes, drawers, dressers, lockers and troughs.') elseif msgcontains(msg, 'coal basin') then buy(cid,3908,getCount(msg),0) elseif msgcontains(msg, 'birdcage') then buy(cid,3918,getCount(msg),0) elseif msgcontains(msg, 'harp') then buy(cid,3917,getCount(msg),0) elseif msgcontains(msg, 'piano') then buy(cid,3926,getCount(msg),0) elseif msgcontains(msg, 'globe') then buy(cid,3927,getCount(msg),0) elseif msgcontains(msg, 'clock') then buy(cid,3933,getCount(msg),0) elseif msgcontains(msg, 'lamp') then buy(cid,3937,getCount(msg),0) elseif msgcontains(msg, 'more') then selfSay('Mais? Tenho: coal basins, birdcages, harps, pianos, globes, clocks and lamps.') elseif msgcontains(msg, 'blue tapestry') then buy(cid,1872,getCount(msg),0) elseif msgcontains(msg, 'green tapestry') then buy(cid,1860,getCount(msg),0) elseif msgcontains(msg, 'orange tapestry') then buy(cid,1866,getCount(msg),0) elseif msgcontains(msg, 'pink tapestry') then buy(cid,1857,getCount(msg),0) elseif msgcontains(msg, 'red tapestry') then buy(cid,1869,getCount(msg),0) elseif msgcontains(msg, 'white tapestry') then buy(cid,1880,getCount(msg),0) elseif msgcontains(msg, 'yellow tapestry') then buy(cid,1863,getCount(msg),0) elseif msgcontains(msg, 'tapestry') or msgcontains(msg, 'tapestries') then selfSay('Tapestries? Tenho: blue, green, orange, pink, red, white and yellow tapestry.') elseif msgcontains(msg, 'small purple pillow') then buy(cid,1678,getCount(msg),0) elseif msgcontains(msg, 'small green pillow') then buy(cid,1679,getCount(msg),0) elseif msgcontains(msg, 'small red pillow') then buy(cid,1680,getCount(msg),0) elseif msgcontains(msg, 'small blue pillow') then buy(cid,1681,getCount(msg),0) elseif msgcontains(msg, 'small orange pillow') then buy(cid,1682,getCount(msg),0) elseif msgcontains(msg, 'small turquiose pillow') then buy(cid,1683,getCount(msg),0) elseif msgcontains(msg, 'small white pillow') then buy(cid,1684,getCount(msg),0) elseif msgcontains(msg, 'heart pillow') then buy(cid,1685,getCount(msg),0) elseif msgcontains(msg, 'blue pillow') then buy(cid,1686,getCount(msg),0) elseif msgcontains(msg, 'red pillow') then buy(cid,1687,getCount(msg),0) elseif msgcontains(msg, 'green pillow') then buy(cid,1688,getCount(msg),0) elseif msgcontains(msg, 'yellow pillow') then buy(cid,1689,getCount(msg),0) elseif msgcontains(msg, 'round blue pillow') then buy(cid,1690,getCount(msg),0) elseif msgcontains(msg, 'round red pillow') then buy(cid,1691,getCount(msg),0) elseif msgcontains(msg, 'round purple pillow') then buy(cid,1692,getCount(msg),0) elseif msgcontains(msg, 'round turquiose pillow') then buy(cid,1693,getCount(msg),0) elseif msgcontains(msg, 'small') then selfSay('Pekenos? Tenho: small purple, small green, small red, small blue, small orange, small turquiose and small white pillows.') elseif msgcontains(msg, 'round') then selfSay('Redondos? Tenho: round blue, round red, round purple and round turquiose pillows.') elseif msgcontains(msg, 'square') then selfSay('Quadrados? Tenho: blue, red, green and yellow pillows.') elseif msgcontains(msg, 'pillows') then selfSay('Traviseiros? Tenho: heart, small, sqare and round pillows.') end if msgcontains(msg, 'backpacks') then selfSay('Tenho a verde, azul, amarela, vermelha, cinza, beggy, fur, pirate, old, tiquanda, star backpack).') elseif msgcontains(msg, 'potions') then selfSay('Tenho, strong health potion (lv 80 Knight and Pally), strong mana potion (lv 50 Druid, Paladin and Sorcerer) great mana potion (Sorcerer and Druid) , great health potion (Knight and Druid lv 80.') elseif msgcontains(msg, 'wands') then selfSay('Tenho, wand of inferno , plague , cosmic energy , vortex and dragonbreath.') elseif msgcontains(msg, 'rods') then selfSay('Tenho, quagmire, snakebite, tempest, volcanic and moonlight rod.') elseif msgcontains(msg, 'verde backpack') then count = getCount(msg) if count == 0 then selfSay('0 ? LOL?') talk_start = os.clock() else buy(cid,1998,count,0) end elseif msgcontains(msg, 'azul backpack') then count = getCount(msg) if count == 0 then selfSay('0 ? LOL?') talk_start = os.clock() else buy(cid,2002,count,0) end elseif msgcontains(msg, 'vermelha backpack') then count = getCount(msg) if count == 0 then selfSay('0 ? LOL?') talk_start = os.clock() else buy(cid,200,count,0) end elseif msgcontains(msg, 'amarela backpack') then count = getCount(msg) if count == 0 then selfSay('0 ? LOL?') talk_start = os.clock() else buy(cid,2004,count,0) end elseif msgcontains(msg, 'beggy backpack') then count = getCount(msg) if count == 0 then selfSay('0 ? LOL?') talk_start = os.clock() else buy(cid,1999,count,0) end elseif msgcontains(msg, 'cinza backpack') then count = getCount(msg) if count == 0 then selfSay('0 ? LOL?') talk_start = os.clock() else buy(cid,2003,count,0) end elseif msgcontains(msg, 'star backpack') then count = getCount(msg) if count == 0 then selfSay('0 ? LOL?') talk_start = os.clock() else buy(cid,5949,count,0) end elseif msgcontains(msg, 'tiquanda backpack') then count = getCount(msg) if count == 0 then selfSay('0 ? LOL?') talk_start = os.clock() else buy(cid,3940,count,0) end elseif msgcontains(msg, 'pirata backpack') then count = getCount(msg) if count == 0 then selfSay('0 ? LOL?') talk_start = os.clock() else buy(cid,5926,count,0) end elseif msgcontains(msg, 'fur backpack') then count = getCount(msg) if count == 0 then selfSay('0 ? LOL?') talk_start = os.clock() else buy(cid,7342,count,0) end elseif msgcontains(msg, 'old backpack') then count = getCount(msg) if count == 0 then selfSay('0 ? LOL?') talk_start = os.clock() else buy(cid,2365,count,0) end elseif msgcontains(msg, 'shovel') then buy(cid,2554,getCount(msg),0) elseif msgcontains(msg, 'backpack') then buy(cid,1988,getCount(msg),0) elseif msgcontains(msg, 'aol') then buy(cid,2173,getCount(msg),0) elseif msgcontains(msg, 'inferno') then count = getCount(msg) if count == 0 then selfSay('0 wand of inferno? LOL?') talk_start = os.clock() else buy(cid,2187,count,0) end elseif msgcontains(msg, 'plague') then count = getCount(msg) if count == 0 then selfSay('0 wand of plague? LOL?') talk_start = os.clock() else buy(cid,2188,count,0) end elseif msgcontains(msg, 'cosmic energy') then count = getCount(msg) if count == 0 then selfSay('0 wand of cosmic energy? LOL?') talk_start = os.clock() else buy(cid,2189,count,0) end elseif msgcontains(msg, 'vortex') then count = getCount(msg) if count == 0 then selfSay('0 wand of vortex? LOL?') talk_start = os.clock() else buy(cid,2190,count,0) end elseif msgcontains(msg, 'dragonbreath') then count = getCount(msg) if count == 0 then selfSay('0 Wand of Dragonbreath? LOL?') talk_start = os.clock() else buy(cid,2191,count,0) end -- fim da venda de wands =) -- inicio da venda de rods =) elseif msgcontains(msg, 'quagmire') then count = getCount(msg) if count == 0 then selfSay('0 Quagmire Rod? LOL?') talk_start = os.clock() else buy(cid,2181,count,0) end elseif msgcontains(msg, 'snakebite') then count = getCount(msg) if count == 0 then selfSay('0 Snakebite Rod? LOL?') talk_start = os.clock() else buy(cid,2182,count,0) end elseif msgcontains(msg, 'tempest') then count = getCount(msg) if count == 0 then selfSay('0 Tempest Rod? LOL?') talk_start = os.clock() else buy(cid,2183,count,0) end elseif msgcontains(msg, 'volcanic') then count = getCount(msg) if count == 0 then selfSay('0 Volcanic Rod? LOL?') talk_start = os.clock() else buy(cid,2185,count,0) end elseif msgcontains(msg, 'moonlight') then count = getCount(msg) if count == 0 then selfSay('0 Moonlight Rod? LOL?') talk_start = os.clock() else buy(cid,2186,count,0) end elseif msgcontains(msg, 'strong health potion') then count = getCount(msg) if count == 0 then selfSay('0 ? LOL?') talk_start = os.clock() else buy(cid,7588,count,0) end elseif msgcontains(msg, 'strong mana potion') then count = getCount(msg) if count == 0 then selfSay('0 ? LOL?') talk_start = os.clock() else buy(cid,7589,count,0) end elseif msgcontains(msg, 'great mana potion') then count = getCount(msg) if count == 0 then selfSay('0 ? LOL?') talk_start = os.clock() else buy(cid,7590,count,0) end elseif msgcontains(msg, 'great health potion') then count = getCount(msg) if count == 0 then selfSay('0 ? LOL?') talk_start = os.clock() else buy(cid,7591,count,0) end elseif msgcontains(msg, 'hmm') then count = getCount(msg) if count == 0 then selfSay('0 Hmm? LOL?') talk_start = os.clock() else buy(cid,2311,count,0) end elseif msgcontains(msg, 'uh') then count = getCount(msg) if count == 0 then selfSay('0 UH? LOL?') talk_start = os.clock() else buy(cid,2273,count,0) end elseif msgcontains(msg, 'gfb') then count = getCount(msg) if count == 0 then selfSay('0 GFB? LOL?') talk_start = os.clock() else buy(cid,2304,count,0) end elseif msgcontains(msg, 'explosion') then count = getCount(msg) if count == 0 then selfSay('0 EXPLO? LOL?') talk_start = os.clock() else buy(cid,2313,count,0) end elseif msgcontains(msg, 'sd') then count = getCount(msg) if count == 0 then selfSay('0 SD? LOL?') talk_start = os.clock() else buy(cid,2268,count,0) end elseif msgcontains(msg, 'blank rune') then count = getCount(msg) if count == 0 then selfSay('0 Blank rune? LOL?') talk_start = os.clock() else buy(cid,2260,count,0) end [color=Red]elseif msgcontains(msg, 'mana rune') then count = getCount(msg) if count == 0 then selfSay('0 Mana Rune? LOL?') talk_start = os.clock() else buy(cid,[color=Lime]2298[/color],count,0) end [/color] elseif string.find(msg, '(%a*)bye(%a*)') and getDistanceToCreature(cid) < 4 then selfSay('Adeus, ' .. creatureGetName(cid) .. '!') focus = 0 talk_start = 0 end end end function onCreatureChangeOutfit(creature) end function onThink() if (os.clock() - talk_start) > 30 then if focus > 0 then selfSay('Proximo...') end focus = 0 end if focus ~= 0 then if getDistanceToCreature(focus) > 5 then selfSay('Que mal educado eim! Nem fala Bye. Adeus!.') focus = 0 end end end Obs.: Editei pra botar ele melhor, em verde é o id da mana rune. Se o seu ot nao tiver mana rune, delete o que está em vermelho. Copie qualquer arquivo .lua na pasta do seu ot em Data/npc/scripts. Cole nessa pasta. abra ele, apague tudo e bote o script acima. Salve e feche. depois renomeie para mordomo.lua. Depois va na pasta data/npc. copie qualquer arquivo .xml. abra ele, apague tudo e ponha isso. <?xml version="1.0"?> <npc name="Mordomo" script="data/npc/scripts/mordomo.lua" access="3" lookdir="1" autowalk="25"> <health now="1000" max="1000"/> <look type="133" head="114" body="114" legs="126" feet="114"/> </npc> Salve e feche. Renomeie para Mordomo.xml Vlw galera ! duvida poste nesse tópico !! Testado em Striker Server 8.10. by me cya (Y) Edit: Podem usar ele para vender mais coisas como itens novos. Nao permito a copia desse Topico. qualquer copia eu irei reportar. Para editar o preco, bote em count, o valor dos gold. para botar um item novo, edite um, ou copie. Edited August 1, 2008 by MarcellooC2 Share this post Link to post
MarcellooC2 0 #2 Posted July 31, 2008 o meu topico ta na secao errada, algum moderador move ele pra a area de scripting de npcs ai =] Share this post Link to post
esterno 0 #3 Posted July 31, 2008 jauHAuahuAHUAHUAHauhauauHAua. vo falr ct pra me ensinar essas parada!!!! [email protected] Share this post Link to post
Mionzinho 0 #5 Posted August 2, 2008 Puf, só junto as funções de outros npc's em um só e mudou o nome :S De qualquer forma...há quem goste! Share this post Link to post
lukinha017 0 #6 Posted August 3, 2008 tdo de graça? isso é pra OT muito zuado, que em 5 minutos cata lvl 9999 mais no geral aprovei né !? Share this post Link to post
vdzz 15 #7 Posted August 3, 2008 Um NPC simples, mais que será de grande utilidade para servers com experiencia relativamente alta, só acho que o nome nao combina mto :s Share this post Link to post
Mush 0 #8 Posted August 3, 2008 Bom, é uma grande ultilidade para vip system em servidores de rates altas So que para ficar corretamente você deveria fazer com que ele venda apenas runas de 10x e potions sem a bp, assim ficaria mais ultil. Share this post Link to post
MarcellooC2 0 #9 Posted August 3, 2008 eu juntei um monte de npc nele mesmo, adicionei manarune, fiz as falas, ajeitei o script etc Share this post Link to post
Nietzsch 0 #10 Posted August 7, 2008 É sinceramente...Não é mtu utilizavél...Mas se alguem quiser já tem!.. Nota 7/10 pela raça ^^ Share this post Link to post