tive uma ideia tosca para exercer minhas praticas nPC makernicais ;D
e resolvi cria um NPC ki vende instrumentos musicas
nao sei si alguem jah tinha pensado ou criado
isso mais eu nunk vi
itaum resolvi cria
;D
vamos lah
1- va na pasta do Seu ot.. abra a pasta Data e depois a NPC
2- crie um novo arquivo .XML e renomeie para Lombard
3- abra e adicione isso dentro:
<?xml version="1.0"?><npc name="Lombard" script="data/npc/scripts/musica.lua" access="3" lookdir="1">
<health now="1" max="1"/>
<look type="57" head="20" body="30" legs="40" feet="50" corpse="3128"/>
</npc>
3a) depois feche e salve.
4- Após ter feito isso va na pasta script (dentro da pasta NPC) e crie um novo arquivo .LUA
5- Renomeie para musica
6- Dentro Coloque assim:
------------------- NPC TOTAL BY NOXIDY -------------------focus = 0
talk_start = 0
target = 0
following = false
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('Opa ' .. creatureGetName(cid) .. '! eu vendo drum, simple fanfare, fanfare, royal fanfare, post horn, panpipes, lyre, lute e flute (Todas 100gp cada. Qual voce Quer?')
focus = cid
talk_start = os.clock()
elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Calma ae, ' .. creatureGetName(cid) .. '! eu falo com voce depois.')
elseif focus == cid then
talk_start = os.clock()
if msgcontains(msg, 'drum') then
buy(cid,2073,1,100)
elseif msgcontains(msg, 'simple fanfare') then
buy(cid,2368,1,100)
elseif msgcontains(msg, 'fanfare') then
buy(cid,2076,1,100)
elseif msgcontains(msg, 'royal fanfare') then
buy(cid,2077,1,100)
elseif msgcontains(msg, 'lute') then
buy(cid,2370,1,100)
elseif msgcontains(msg, 'post horn') then
buy(cid,2364,1,100)
elseif msgcontains(msg, 'panpipes') then
buy(cid,2373,1,100)
elseif msgcontains(msg, 'lyre') then
buy(cid,2372,1,100)
elseif msgcontains(msg, 'flute') then
buy(cid,2374,1,100)
elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
selfSay('Xau, ' .. 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(0)
end
if ((myy-y==0) and (myx-x>=0 and myx-x<=4)) then
selfTurn(2)
end
if ((myx-x==0) and (myy-y<=0 and myy-y>=-4)) then
selfTurn(1)
end
if ((myx-x==0) and (myy-y>=0 and myy-y<=4)) then
selfTurn(3)
end
if ((myy-y==-2) and (myx-x>=-1 and myx-x<=1)) then
selfTurn(1)
end
if ((myy-y==2) and (myx-x>=-1 and myx-x<=1)) then
selfTurn(3)
end
if ((myx-x==2) and (myy-y>=-1 and myy-y<=1)) then
selfTurn(2)
end
if ((myx-x==-2) and (myy-y>=-1 and myy-y<=1)) then
selfTurn(0)
end
if ((myy-y==-3) and (myx-x>=-2 and myx-x<=2)) then
selfTurn(1)
end
if ((myy-y==3) and (myx-x>=-2 and myx-x<=2)) then
selfTurn(3)
end
if ((myx-x==3) and (myy-y>=-2 and myy-y<=2)) then
selfTurn(2)
end
if ((myx-x==-3) and (myy-y>=-2 and myy-y<=2)) then
selfTurn(0)
end
if ((myy-y==-4) and (myx-x>=-3 and myx-x<=3)) then
selfTurn(1)
end
if ((myy-y==4) and (myx-x>=-3 and myx-x<=3)) then
selfTurn(3)
end
if ((myx-x==4) and (myy-y>=-3 and myy-y<=3)) then
selfTurn(2)
end
if ((myx-x==-4) and (myy-y>=-3 and myy-y<=3)) then
selfTurn(0)
end
end
if (os.clock() - talk_start) > 30 then
if focus > 0 then
selfSay('Proximo...')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Adeus.')
focus = 0
end
end
end
6a) Feche e salve!
Pronto Seu NPC de Musica esta criado!!
Creditos by: Noxidy__
~* COMENTS *~