Pra quem não entendeu no título, é que o nosso amigo Seller, vai vender Bps de cores diferentes em cada cidade, isso mesmo, o MESMO Seller
Foi descoberto por acidente, e queria que nao ripassem¬¬
A Versão é Zorzin 1.1
Vamos começar, pegue o seller.xml, dê um ctrl+c e cole umas 4x
Agora pegue o primeiro seller, renomeie para seller_karmia
Abra-o e ponha isto no lugar do que está escrito:
<?xml version="1.0"?> <npc name="Seller" script="data/npc/scripts/seller_karmia.lua" access="3"> <mana now="800" max="800"/> <health now="800" max="800"/> <look type="129" head="0" body="86" legs="61" feet="86" addons="3"/> </npc>
Certo, agora vamos direto criar o arquivo script, vá na pasta scripts, pegue o seller.lua, renomeie para seller_karmia e cole isso:
-- Npc by Zorzin =), Edited by Rafixlocal 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)
-- greeting phrase
if string.find(msg, '(%a*)hi(%a*)') and focus == 0 and string.len(msg) == 2 and getDistanceToCreature(cid) < 4 then
selfSay('Hello ' .. creatureGetName(cid) .. '! I sell ropes (50gp), shovels (30gp), backpacks (20gp), manafluids (100gp), lifefluids (60gp), fishing rods (100gp) and torches (2gp), obsidian knife (4k).')
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()
-- Mensages:
buy_error = 'Sorry, you dont have enough money.'
buy_ok = 'Here you are.'
buy_no = 'Ok. Maybe another time.'
--
sell_error = 'Sorry, you dont have that item.'
sell_ok = 'Thanks for this item.'
sell_no = 'Ok. Maybe another time.'
--
if msgcontains(msg, 'rope') then
bs,itemid,count,subtype,price,iscountable,article,name,plural = 'buy',2120,getCountNumber(msg),0,50,0,'a','rope','ropes'
sendMsgBuySell(cid,itemid,count,price,article,name,plural,bs)
talk_state = 302
elseif msgcontains(msg, 'shovel') then
bs,itemid,count,subtype,price,iscountable,article,name,plural = 'buy',2554,getCountNumber(msg),0,30,0,'a','shovel','shovels'
sendMsgBuySell(cid,itemid,count,price,article,name,plural,bs)
talk_state = 302
elseif msgcontains(msg, 'backpack') then
bs,itemid,count,subtype,price,iscountable,article,name,plural = 'buy',1988,getCountNumber(msg),0,20,0,'a','backpack','backpacks'
sendMsgBuySell(cid,itemid,count,price,article,name,plural,bs)
talk_state = 302
elseif msgcontains(msg, 'manafluid') or msgcontains(msg, 'mana') then
bs,itemid,count,subtype,price,iscountable,article,name,plural = 'buy',2006,getCountNumber(msg),7,100,0,'a','vial of manafluid','vials of manafluid'
sendMsgBuySell(cid,itemid,count,price,article,name,plural,bs)
talk_state = 302
elseif msgcontains(msg, 'lifefluid') or msgcontains(msg, 'life') then
bs,itemid,count,subtype,price,iscountable,article,name,plural = 'buy',2006,getCountNumber(msg),10,60,0,'a','vial of lifefluid','vials of lifefluid'
sendMsgBuySell(cid,itemid,count,price,article,name,plural,bs)
talk_state = 302
elseif msgcontains(msg, 'fishing') then
bs,itemid,count,subtype,price,iscountable,article,name,plural = 'buy',2580,getCountNumber(msg),0,100,0,'a','fishing rod','fishing rods'
sendMsgBuySell(cid,itemid,count,price,article,name,plural,bs)
talk_state = 302
elseif msgcontains(msg, 'torch') then
bs,itemid,count,subtype,price,iscountable,article,name,plural = 'buy',2050,getCountNumber(msg),0,2,0,'a','torch','torches'
sendMsgBuySell(cid,itemid,count,price,article,name,plural,bs)
talk_state = 302
elseif msgcontains(msg, 'obsidian knife') then
bs,itemid,count,subtype,price,iscountable,article,name,plural = 'buy',5908,getCountNumber(msg),0,4000,0,'an','obsidian knife','obsidian knifes'
sendMsgBuySell(cid,itemid,count,price,article,name,plural,bs)
talk_state = 302
-----------------------
elseif talk_state == 302 then
if msgcontains(msg, 'yes') or msgcontains(msg, 'no') then
if bs == 'buy' then
buyItem(cid,itemid,count,subtype,price,iscountable,name,plural,buy_error,buy_ok,
buy_no,msg)
else
sellItem(cid,itemid,count,subtype,price,iscountable,sell_error,sell_ok,sell_no,m
sg)
end
talk_state = 0
end
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(1)
end
if ((myy-y==0) and (myx-x>=0 and myx-x<=4)) then
selfTurn(3)
end
if ((myx-x==0) and (myy-y<=0 and myy-y>=-4)) then
selfTurn(2)
end
if ((myx-x==0) and (myy-y>=0 and myy-y<=4)) then
selfTurn(0)
end
if ((myy-y==-2) and (myx-x>=-1 and myx-x<=1)) then
selfTurn(2)
end
if ((myy-y==2) and (myx-x>=-1 and myx-x<=1)) then
selfTurn(0)
end
if ((myx-x==2) and (myy-y>=-1 and myy-y<=1)) then
selfTurn(3)
end
if ((myx-x==-2) and (myy-y>=-1 and myy-y<=1)) then
selfTurn(1)
end
if ((myy-y==-3) and (myx-x>=-2 and myx-x<=2)) then
selfTurn(2)
end
if ((myy-y==3) and (myx-x>=-2 and myx-x<=2)) then
selfTurn(0)
end
if ((myx-x==3) and (myy-y>=-2 and myy-y<=2)) then
selfTurn(3)
end
if ((myx-x==-3) and (myy-y>=-2 and myy-y<=2)) then
selfTurn(1)
end
if ((myy-y==-4) and (myx-x>=-3 and myx-x<=3)) then
selfTurn(2)
end
if ((myy-y==4) and (myx-x>=-3 and myx-x<=3)) then
selfTurn(0)
end
if ((myx-x==4) and (myy-y>=-3 and myy-y<=3)) then
selfTurn(3)
end
if ((myx-x==-4) and (myy-y>=-3 and myy-y<=3)) then
selfTurn(1)
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
Bom, este foi o npc de karmia, agora falta o resto, é só copiar e colar, renomear para as cidades e etc, mas não esqueça, não troque o npc name, deixe como seller mesmo!
=]
Quanto aos scripts, é só você copiar e mudar o id das bps que você quiser.
Não está melhor explicado por falta de tempo, mas se você preferir pode fazer download, mas tem que esperar até amanhã quando farei upload.