Ir para conteúdo
Entre para seguir isso  
Stanislal

Fazendo Npc Vende Bp De Itens...

Recommended Posts

Stanislal    0
Stanislal

TESTADO NA VERSÃO 8.1!!!! :)

GENTE ESSE É MEU PRIMEIRO TROPICO...

VOU ENSINAR COMO FAZER NPC QUE VENDE BP DE ARROW E BOLTS.

:DVAMOS COMEÇAR:D

VAI EM data\npc E COMPIA QUALQUER DOCUMENTO.XML E MODIFIQUE COM O NOME DE "PAPERS".

COLE ISSO:

 

<?xml version="1.0"?>
<npc name="Papers" script="data/npc/scripts/bparquer.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 VAI EM data\npc\scripts E COPIA QUALQUER ARQUIVO.LUA E TROQUE O NOME PARA "BPARQUER"

 

E COLE ISSO DENTRO:

 

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('Thau. Deus Abençõe.')
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) .. '! Eu vendo Bp Arrow e bp Bolt (2k) By Papers ')
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, 'info') then
selfSay('Todos os creditos são by Papers (server).')

elseif msgcontains(msg, 'bp arrow') then
buyContainer(cid,7342,2544,100,2000)

elseif msgcontains(msg, 'bp bolt') then
buyContainer(cid,7342,2543,100,2000)

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

SALVE AS ALTERAÇÕES E PRONTO...

SE QUER MODIFICAR O NOME DO NPC...

FAÇA O SEGUINTE:

VÁ EM data\npc

 

RENOMEIA O DOCUMENTO.XML COM O NOME DESEJADO EXEMPLO "OBI"

E AGORA ABRA O DOCUMENTO.XML E MUDA O NOME. VEJA EM BAIXO:

 

<npc name="NOVO NOME AKI" script="data/npc/scripts/bparquer.lua" access="9" autowalk="0">

SE KISER QUE SEU NPC VENDE COISAS EXTRAS COMO BP DE "RUNA" OU "SPEARS". VEJA EM BAIXO:

 

elseif msgcontains(msg, 'PALAVRA CHAVE PARA ATIVAR.') then
buyContainer(cid,(7342 É O ID DA BP QUE VAI SER FEITA),(2544 É O ID DO ITEM QUE VAI SER CRIADO DENTRO DA BP),(100 A QUANTIDADE DO ITEM EM CADA SQM DA BP. EXP:SD 20 RUNA 100 TIRO EM RUNA.),(2000 O PREÇO DA BP.))

IRIA FICAR SE FOSSE CRIAR UMA BP DE SD FIKARIA ASSIM: PRA VCS TEREM COMO EXEMPLO:

 

elseif msgcontains(msg, 'bp sd') then
buyContainer(cid,2003,2268,100,10000)

COMO N GOSTO DE ERRORS VO DEMONSTRAR AKI:

VOCE VAI COLAR ESSA NOVA BP SD NA DATA\NPC\SCRIPS
FIKARIA ASSIM:

[php]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('Thau. Deus Abençõe.')
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) .. '! Eu vendo Bp Arrow e bp Bolt (2k) By Papers ')
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, 'info') then
selfSay('Todos os creditos são by Papers (server).')

elseif msgcontains(msg, 'bp arrow') then
buyContainer(cid,7342,2544,100,2000)

elseif msgcontains(msg, 'bp sd') then
buyContainer(cid,2003,2268,100,10000)

elseif msgcontains(msg, 'bp bolt') then
buyContainer(cid,7342,2543,100,2000)

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

NAUM SE ESQUEÇAM DE MUDAR ISSO:

 

if msgcontains(msg, 'hi') and focus == 0 and getDistanceToCreature(cid) < 4 then
selfSay('Hello ' .. creatureGetName(cid) .. '! Eu vendo Bp Arrow e bp Bolt (2k) By Papers ')
focus = cid
talk_start = os.clock()

PARA

 

if msgcontains(msg, 'hi') and focus == 0 and getDistanceToCreature(cid) < 4 then
selfSay('Hello ' .. creatureGetName(cid) .. '! Eu vendo Bp Arrow e bp Bolt (2k) e vendo bp sd (10k) By Papers ')
focus = cid
talk_start = os.clock()

PARA INFORMAR QUE TEM BP DE SD TBM...

 

É ISSO OBRIGADO E DESCULPA QUALQUER COISA PQ SO AMADOR 1 TROPICO...

=D

SE JA TEM UM TROPICO ENSINANDO ISSO DISCULPA... ^^

Compartilhar este post


Link para o post
Compartilhar em outros sites
Nord    2
Nord

Que bom que você trouxe um ensinamento com esse script.

 

Aprovado

Compartilhar este post


Link para o post
Compartilhar em outros sites
Taslehoff    0
Taslehoff

Boa com esse tRRRRRRRopico xP Tirando isso muito bom ou procurar uma forma de aplicar isso no meu ot xD vlws e continue!

Compartilhar este post


Link para o post
Compartilhar em outros sites
Skinlitte    0
Skinlitte

nao ta funfando na 8.31 SQL ñ

Compartilhar este post


Link para o post
Compartilhar em outros sites
Keven Reis    0
Keven Reis

Muito bom,os player ja tavam mi exendo no meu ot :D THANKS MAN!

Compartilhar este post


Link para o post
Compartilhar em outros sites

Faça login para comentar

Você vai ser capaz de deixar um comentário após fazer o login



Entrar Agora
Entre para seguir isso  

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×