NO

Npc Que Vende Intrumentos Musicais

Por Noxidy__, 15 de out. de 2006 em NPCs, monsters e raids

script
10
2.8k
Noxidy__N
15 de outubro de 2006 às 11:40

:D

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 *~

aiolaA
15 de outubro de 2006 às 17:54

e bem divertido e lgl pra quem gosta de ter um server com um monte de npcs esse e bem diferente

Noxidy__N
22 de outubro de 2006 às 16:07

@aiola

valeu pelo comentario :D

@Xtibia

axo ki meus npc nem agradam muito =/

LukituzL
22 de outubro de 2006 às 16:19

Adorei seu npc, vou ver algum lugar aqui para coloca-lo.

:bye:

EigenliebE
23 de outubro de 2006 às 16:25

Olá!

Tópico Movido

Poste sempre seus Npc's na seção correta ;)

Abraços

PedrinhuHenriqueP
23 de outubro de 2006 às 19:59

cara como coloka npc no mapa naum sei tem como me ajudar?

RocksodyR
23 de outubro de 2006 às 21:11

@Pedrinhu

Dentro da pasta com os arquivos do seu ots tem uma pasta chamada data.

Dentro de datas tem outra chamada world.

Dentro da world tem um arquivo chamado npc.

Abra esse arquivo, copie uma das linhas com qualquer otro npc e troque o nome para Lombard e as coordenadas de acordo a onde voce quer que ele fique.

Desculpa falei meio rapido e enrrolado que tenho que sair, espero ter ajudado, otro dia editarei.

@Noxidy__

O npc nao e tosco nao! ja sabia fazer mas nunca tive essa ideia! curti! vlw xD

o/ Paz

Editado Outubro 23 por Rocksody

1 mês depois...
28 de novembro de 2006 às 18:11

Tem alguns instrumentos que ficam fixos no chão, vou ter que tirar eles da lista. Gostei do script, semelhante ao Tibia Rl.

RocksodyR
04 de dezembro de 2006 às 20:12

~sky hunter

eu tiver esse problema tambem mas ai o npc fica sem graca, portanto tente mudar as configuracoes dos items no arquio item.otb

abco

5 meses depois...
skynagerloasS
25 de maio de 2007 às 14:02

Tópico contendo somente 1 NpC,

essa seção é para DataPacks com 3 ou mais Npcs,

~o{Tópico Movido}o~,

Abraços.