FI

Npc Que Vende Bp's De Potions

Por Filipinho1993, 01 de nov. de 2008 em NPCs, monsters e raids

script
11
3.4k
Filipinho1993F
01 de novembro de 2008 às 08:43

Olá galera tudo fmz com vcs :) criei um npc que vende bp's de potions mais antes alguém pode mi ensinar a colocar em quoted ou code. Bem por enquanto eu ainda nao sei mais msm assim vo posta sem o quoted e code. aki vai em data/npc e coloke isto:

 

<?xml version="1.0"?>

 

<npc name="Vendedora de Bps de Potions" script="data/npc/scripts/potions.lua" access="3" lookdir="1" autowalk="100" speed="100">

<health now="100" max="100"/>

<look type="140" head="79" body="17" legs="16" feet="0" addons="3"/>

<parameters/>

</npc>

 

 

agora vá em data/npc/script/potions.lua e copie e colem um documento e coloquem isto:

 

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)

local msg = string.lower(msg)

 

if msgcontains(msg, 'hi') and focus == 0 and getDistanceToCreature(cid) < 4 then

selfSay('Hello ' .. creatureGetName(cid) .. '! I sell potions and bp potions.')

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, 'potions') then

selfSay('I sell Mana Potion (50gps), Health Potion (45gps), SHP (100gps), SMP (80gps), GHP (190gps) and GMP (120gps).')

elseif msgcontains(msg, 'bp potions') then

selfSay('I sell Bp Mana Potion (1k), Bp Health Potion (900gps), Bp SHP (2k), Bp SMP (1.6k), Bp GHP (3.8k) and Bp GMP (2.4k).')

 

elseif msgcontains(msg, 'mp') then

buy(cid,7620,1,50)

elseif msgcontains(msg, 'hp') then

buy(cid,7618,1,45)

elseif msgcontains(msg, 'shp') then

buy(cid,7588,1,100)

elseif msgcontains(msg, 'smp') then

buy(cid,7589,1,80)

elseif msgcontains(msg, 'ghp') then

buy(cid,7591,1,190)

elseif msgcontains(msg, 'gmp') then

buy(cid,7590,1,120)

 

elseif msgcontains(msg, 'bp mana potion') then

buyContainer(cid,2003,7620,1,1000)

 

elseif msgcontains(msg, 'bp health potion') then

buyContainer(cid,2000,7618,1,900)

 

elseif msgcontains(msg, 'bp strong health') then

buyContainer(cid,2001,7588,1,2000)

 

elseif msgcontains(msg, 'bp strong mana') then

buyContainer(cid,2002,7589,1,1600)

 

elseif msgcontains(msg, 'bp great health') then

buyContainer(cid,2000,7591,1,3800)

 

elseif msgcontains(msg, 'bp great mana') then

buyContainer(cid,2000,7590,1,2400)

 

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

 

Bem Galera esse é o npc que criei =D Dúvidas postem aew ;) e comentem do que acharam.

 

~*Créditos*~

100% Eu :) xD!~

 

Vlws Galera ;) Fuiz!!!

Editado Novembro 12 por FiLiPiNnHoOoOoOo

careca21C
01 de novembro de 2008 às 16:44

Muito Legal Cara... mas eu Queria saber Como Por para ele aceitar 1 Tipo de Moeda Só, Como Gold Nigths algo asim Ajdua ae !!

Victor2309V
01 de novembro de 2008 às 20:05

Muito Bom

BillyBolaB
01 de novembro de 2008 às 20:12

Po vei da loko de mais bem organizado colorido muito bom

Filipinho1993F
04 de novembro de 2008 às 00:23

vlw galera.

há alguém tem um ot ae em qual eu possa jogar cansei de global *.* :smile_positivo:

si tiver um passa ip plz "/

daniteroD
07 de novembro de 2008 às 12:47

eh soh botar code para abrir e /code isso entre [ ] e quote e /quote entre [ ] tambem, msm assim vc mudou a cor pra da um destaque e ficou bom, legal esse npc e vc esqueceu de botar la encima, qdo copiar e colar renomear para "potions.lua" dps da uma editada, parabens e abraços

Editado Novembro 7 por danitero

Filipinho1993F
12 de novembro de 2008 às 17:14

vlw por mi ensinar =D

Editado Novembro 12 por FiLiPiNnHoOoOoOo

jottageJ
16 de novembro de 2008 às 00:11

Valew :D

 

muiuto boomja ta no oT

GuiniudesG
16 de novembro de 2008 às 02:09

po cara eu ja tinha postado um npc desse aqui no forum. Pesquise antes de postar os topicos mas fora isso o npc esta funfando direitinho APROVADO

 

Cya

1 mês depois...
BrasildaniB
13 de dezembro de 2008 às 19:25

belo tuto parabens :party:

O VC SABE FAZE ALAVANCA DE VENDE POTION VLW
yashaY
18 de dezembro de 2008 às 09:21

Gostei muito do npc..

Parabéns pelo tópico, está muito bem organizado...