Bom galera do Xtibia to trazendo um npc que vende bp de runas,muito util,bom muitos nao funfavam pois certos ots nao possuiam tal código,mais esse funfa 100%
Bem vamos ao codigo:
Vá em [data/npc] e copie
<?xml version="1.0"?><npc name="Bob" script="data/npc/scripts/bprunes.lua" access="9" autowalk="0">
<mana now="800" max="800"/>
<health now="200" max="200"/>
<look type="134" head="78" body="88" legs="0" feet="88"/>
</npc>
Agora Salve e vá para data/npc/scrips copie um arquivo cole la mesmo renomeie para: bprunes,
Apague tudo que estiver nele e coloque:
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('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)
local msg = string.lower(msg)
if msgcontains(msg, 'hi') and focus == 0 and getDistanceToCreature(cid) < 4 then
selfSay('Hello ' .. creatureGetName(cid) .. '! I sell runes, bp runes,wands and rods.')
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, 'runes') then
selfSay('I sell hmms (50gps), uhs (150gps), gfbs (100gps), explosions (150gps), sds (200gps), and blank runes (5gps).')
elseif msgcontains(msg, 'wands') then
selfSay('I sell wand of inferno (15k), plague (5k), cosmic energy (10k), vortex (500gp) and dragonbreath (1k).')
elseif msgcontains(msg, 'rods') then
selfSay('I sell quagmire (10k), snakebite (500gp), tempest (15k), volcanic (5k) and moonlight rod (1k).')
elseif msgcontains(msg, 'inferno') then
buy(cid,2187,getCount(msg),15000)
elseif msgcontains(msg, 'plague') then
buy(cid,2188,getCount(msg),5000)
elseif msgcontains(msg, 'cosmic energy') then
buy(cid,2189,getCount(msg),10000)
elseif msgcontains(msg, 'vortex') then
buy(cid,2190,getCount(msg),500)
elseif msgcontains(msg, 'dragonbreath') then
buy(cid,2191,getCount(msg),1000)
elseif msgcontains(msg, 'quagmire') then
buy(cid,2181,getCount(msg),10000)
elseif msgcontains(msg, 'snakebite') then
buy(cid,2182,getCount(msg),500)
elseif msgcontains(msg, 'tempest') then
buy(cid,2183,getCount(msg),15000)
elseif msgcontains(msg, 'volcanic') then
buy(cid,2185,getCount(msg),5000)
elseif msgcontains(msg, 'moonlight') then
buy(cid,2186,getCount(msg),1000)
elseif msgcontains(msg, 'bp mf') then
buyContainer(cid,2003,2006,7,2000)
elseif msgcontains(msg, 'bp sd') then
buyContainer(cid,2003,2268,100,6000)
elseif msgcontains(msg, 'bp explosion') then
buyContainer(cid,2000,2313,100,4000)
elseif msgcontains(msg, 'bp uh') then
buyContainer(cid,2001,2273,100,3000)
elseif msgcontains(msg, 'bp hmm') then
buyContainer(cid,2002,2311,100,2000)
elseif msgcontains(msg, 'bp gfb') then
buyContainer(cid,2000,2304,2,3000)
elseif msgcontains(msg, 'hmm') then
buy(cid,2311,getCount(msg),100)
elseif msgcontains(msg, 'uh') then
buy(cid,2273,getCount(msg),150)
elseif msgcontains(msg, 'gfb') then
buy(cid,2304,getCount(msg),150)
elseif msgcontains(msg, 'explosion') then
buy(cid,2313,getCount(msg),200)
elseif msgcontains(msg, 'sd') then
buy(cid,2268,getCount(msg),300)
elseif msgcontains(msg, 'blank') then
buy(cid,2260,getCount(msg),5)
elseif string.find(msg, '(%a*)bye(%a*)') 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 (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
Créditos
Este script foi feito por Tibiano Forever.
Espero que gostem galera.E que aproveitem bem.