Bps De Cores Diferentes Em Cada Cidade Com O Mesmo Npc

Rafix
Por Rafix
em Tutoriais de Scripting

Rafix

Banido
avatar
Barão
Barão

INFOS

Grupo: BarãoRegistrado: 30/08/05Posts: 231Char no Tibia: retired

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 Rafix

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)

 

-- 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.

Usuário Banido.

Motivo: Atitude Ofensivas

XPaulo

avatar
Artesão
Artesão

INFOS

Grupo: ArtesãoRegistrado: 10/02/07Posts: 129

Parabéns,

 

Uma coisa simples mas que eu não tinha notado.

 

 

Só não entendi uma coisa.

 

Porque não pode mudar o nome do npc?

 

 

@Edit

 

Entendi é que você o adapto para o Zorzin.

(¯`·._.·[ Regras ]·._.·´¯)
(¯`·._.·[ Lista de Servidores ]·._.·´¯)
(¯`·._.·[ Notícias ]·._.·´¯)
(¯`·._.·[Recomende o XTibia]·._.·´¯)

Addict

Ex-Diretor de Equipe
avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 12/10/05Posts: 568Gênero: MasculinoChar no Tibia: Homao Dapoha

Movido para Tutoriais relacionados a Scripts.

Zorzin

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 01/02/06Posts: 74

hueaSEHUASeh

 

\o/ My buy/sell system :D \o/

ehsauiehsae =)

 

Bem legal.. =)

 

Mas tem outras formas de fazer isso... Tipo, colocando um Storage Value no player quando ele mudar de cidade, ai dá pra saber em qual cidade que ele está, e assim o Npc Seller usará o mesmo npc script, mas vendendo Bps de cores diferentes dependendo de qual cidade o player estiver.. =D Só é um pouquinho mais complicado.. rsrs

 

Legal o Tuto =)

 

//Zorzin




BlackOnix C++ Programmer
------------------------------------------------------------------------

É meu fan ou gosta dos meus trabalhos ou é meu amigo? Usa minha bar: =)



[7.92] Zorzin OTServer Version 1.1

xhoT-BR

avatar
Artesão
Artesão

INFOS

Grupo: ArtesãoRegistrado: 18/02/07Posts: 115

Não cheguei a testar,

Más parece estar tudo ok.

 

Parabens,

Abraços.

Olá XTibiano!

A sua assinatura estava danificando a estrutura do fórum e foi removida.

Para conferir sua assinatura antiga e restaurá-la, visite "Sobre mim" no seu perfil.

 

Grato pela atenção,

Henrique Moura.

Felipe Moraes

Java Developer
avatar
Grão-Duque
Grão-Duque

INFOS

Grupo: Grão-DuqueRegistrado: 02/10/06Posts: 3285Gênero: Masculino

sim,realmente isso é muito bom,principalmente para aqueles ots que querem fazer igual ao tibia rl...parabens pelo tutorial manow,ficou 10!

~A nossa maior glória não reside no fato de nunca cairmos, mas sim em levantarmo-nos sempre depois de cada queda.~

 

 

 

 

Clique aqui para ver meus tutoriais !

 

 

 

Gamertag: cpmoraes

 

 

Elite Serv

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 16/03/07Posts: 35

carak ajudo abstante vlwss

Sou Hoster
IP: eliteserv.no-ip.biz
Port: 7171
Protocolo: 7.92
Rates: exp 15x ml 50x skills 500x loot 4x
Map: ...


hopugop

avatar
Cavaleiro
Cavaleiro

INFOS

Grupo: CavaleiroRegistrado: 08/01/06Posts: 154

Mesmo mantendo o Nome do NPC, vc mudou o Script dele ¬¬

 

Então vc mudou o NPC

Una-se à minha cruzada: Alternativas ao RapidShare!!

Master Mage

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 21/02/07Posts: 50Char no Tibia: Warrior Ilusion

Legal!!

;)

-LMS-

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 28/03/07Posts: 43Char no Tibia: Rezhos

vc só está copiando os arquivos e mudando para ids de bps diferentes...lol



Att,
Leandro Sousa
webdesigner
leandro_lms@yahoo.com.br

Wenemy

avatar
Artesão
Artesão

INFOS

Grupo: ArtesãoRegistrado: 24/02/08Posts: 134Char no Tibia: Buster of Flame

Vou dar up nesse topico, porque esta explicando a fazer uma coisa muito legal, entao nao reclamem

 

//The Wenemy




//The Wenemy - Mapper



Dorion 7.81 PERFECT

vitiman

avatar
Artesão
Artesão

INFOS

Grupo: ArtesãoRegistrado: 04/04/07Posts: 100

isso vai deixar o ot com um pouco mais de variedade xD