Exclusivo para XTibia
favor não postar em outro forum
HUHU
Vamos brincar de boneca ???
(meu Tutorial n° 24 - UIIII)
Agora temos o NPC Baby Doll
(AhuheHhuahUheE)
1° - Vamos acertar uma das BPs
Confira seu data\items\items.xml
Se estiver assim :
<item id="6579" name=""> <attribute key="weight" value="0"/> </item>
troca por isto :
<item id="6579" name="Guido doll"> <attribute key="weight" value="10"/> </item>
=======================================================================
2° - Criando o NPC
data\npc\BabyDoll.xml
<?xml version="1.0"?> <npc name="Baby Doll" script="data/npc/scripts/doll.lua" access="3" lookdir="1" autowalk="200" speed="200"> <health now="1" max="1"/> <look type="160" head="38" body="79" legs="107" feet="114"/> </npc>
Altere o look type a gosto.
A velocidade de andar e mover eu puz 200
(quase não fica parado e anda na velocidade BOH)
=======================================================================
3° - Criando o Script
data\npc\scripts\doll.lua
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)
if (msgcontains(msg, 'hi') and focus == 0) and getDistanceToCreature(cid) < 4 then
selfSay('Hello ' .. creatureGetName(cid) .. '! I sell all types of Dolls for 10k each.')
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, 'dolls') then
selfSay('I sell doll 1 (1) , doll 2 (2) , vodoo doll (3) , voodoo doll (4) , mysterious fetish (5) , wooden doll (6) , Guido doll (7) , santa doll (8) , panda teddy (9) , bear (10) , panda bear (11).')
selfSay('I can sell specials voodoo skull (12) , stuffed dragon (13) , stuffed rabbit (14).')
elseif msgcontains(msg, 'doll 1') or msgcontains(msg, '1') then
buy(cid,2110,1,10000)
elseif msgcontains(msg, 'doll 2') or msgcontains(msg, '2') then
buy(cid,2322,1,10000)
elseif msgcontains(msg, 'vodoo doll') or msgcontains(msg, '3') then
buy(cid,3955,1,10000)
elseif msgcontains(msg, 'voodoo doll') or msgcontains(msg, '4') then
buy(cid,5810,1,10000)
elseif msgcontains(msg, 'mysterious fetish') or msgcontains(msg, '5') then
buy(cid,2194,1,10000)
elseif msgcontains(msg, 'wooden doll') or msgcontains(msg, '6') then
buy(cid,2108,1,2000)
elseif msgcontains(msg, 'guido doll') or msgcontains(msg, '7') then
buy(cid,6579,1,10000)
elseif msgcontains(msg, 'santa doll') or msgcontains(msg, '8') then
buy(cid,6512,1,10000)
elseif msgcontains(msg, 'panda teddy') or msgcontains(msg, '9') then
buy(cid,6568,1,10000)
elseif msgcontains(msg, 'bear') or msgcontains(msg, '10') then
buy(cid,3954,1,10000)
elseif msgcontains(msg, 'panda bear') or msgcontains(msg, '11') then
buy(cid,5080,1,10000)
elseif msgcontains(msg, 'voodoo skull') or msgcontains(msg, '12') then
buy(cid,5669,1,10000)
elseif msgcontains(msg, 'stuffed dragon') or msgcontains(msg, '13') then
buy(cid,5791,1,10000)
elseif msgcontains(msg, 'stuffed rabbit') or msgcontains(msg, '14') then
buy(cid,2355,1,10000)
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()
doNpcSetCreatureFocus(focus)
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
Se sua versão é 8.0
Substitua isto :
elseif msgcontains(msg, 'panda teddy') or msgcontains(msg, '9') then buy(cid,6568,1,10000)
Esse é Panda Teddy igual o Panda Bear (que já tá ae)
por isto :
elseif msgcontains(msg, 'baby seal doll') or msgcontains(msg, '9') then buy(cid,7184,1,10000)
Esse é a foquinha
O Player vai poder comprar a Boneca pelo nome ou pelo número.
Todas bonecas valem 10K.
Exemplo :
Trecho da fala do NPC
bla-bla-bla (6) , Guido doll (7) , bla-bla-bla
Trecho do Script
elseif msgcontains(msg, 'guido doll') or msgcontains(msg, '7') then buy(cid,6579,15,10000)
Se o Player falar "guido doll" ou "7" ele vai comprar a boneca do Guido por 10K.
(alterar o preço se desejar)
Acho que é só....
:XTibia_smile:
































