Ir para conteúdo
  • Cadastre-se

[Resolvido] Duvida script de npc !


Posts Recomendados

Bom galera eu fiz , ops eu editei um script de npc 7.81 narutibia , oque era para ele fazer : ele seria um tutor explicaria oque é oque como faz oque etc. Porém quando falo com ele , infelizmente ele não responde podem me ajudar ?

script ->

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 ((string.find(msg, '(%a*)hi(%a*)')) and (focus == 0)) and getDistanceToCreature(cid) < 3 then

if getPlayerStorageValue(cid,853) < 1 then

selfSay('Ola ' .. creatureGetName(cid) .. 'bem-vindo ao NSWO e a Academia Shinobi, nela pode falar com varios "npcs" que poderao te "vender" itens e pode explorar "hunts" , ate que chegue a hora de "sair" da academia.')

focus = cid

talk_start = os.clock()

else

selfSay('Espere..')

focus = 0

talk_start = 0

end

elseif string.find(msg, '(%a*)hi(%a*)') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then

selfSay('Desculpe, ' .. creatureGetName(cid) .. '! Estou ocupado')

elseif focus == cid then

talk_start = os.clock()

if msgcontains(msg, 'npcs') and focus == cid then

selfSay('NPC's são personagens controlado pelo computador que podem ter varias funções como vender itens , comprar itens , Dar informações , dar missões e muito mais. Pode falar com eles dizendo : "hi" e "bye" para dizer tchau')

talk_start = os.clock()

end

if msgcontains(msg, 'npc') and focus == cid then

selfSay('NPC's são personagens controlado pelo computador que podem ter varias funções como vender itens , comprar itens , Dar informações , dar missões e muito mais. Pode falar com eles dizendo : "hi" e "bye" para dizer tchau')

talk_start = os.clock()

end

if msgcontains(msg, 'hunt') and focus == cid then

selfSay('Hunts são lugares onde ficam os monstros ou os inimigos, nela você pode caçar com amigos, ganhar exp treinar e muito mais. Cada monstro tem sua experiencia e itens propios')

talk_start = os.clock()

end

if msgcontains(msg, 'hunts') and focus == cid then

selfSay('Hunts são lugares onde ficam os monstros ou os inimigos, nela você pode caçar com amigos, ganhar exp treinar e muito mais. Cada monstro tem sua experiencia e itens propios')

talk_start = os.clock()

end

if msgcontains(msg, 'sair') and focus == cid then

selfSay('Bom , para sair da academia você pode ir pelo Leste , até chegar num porto onde o marinheiro poderá ajudar você se estiver pronto para ir !!')

talk_start = os.clock()

end

if msgcontains(msg, 'ir') and focus == cid then

selfSay('Bom , para sair da academia você pode ir pelo Leste , até chegar num porto onde o marinheiro poderá ajudar você se estiver pronto para ir !!')

talk_start = os.clock()

end

if string.find(msg, '(%a*)bye(%a*)') and focus == cid and getDistanceToCreature(cid) < 3 then

selfSay('Good bye, ' .. creatureGetName(cid) .. '!')

focus = 0

talk_start = 0

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 focus == 0 then

randmove = math.random(1,50)

if randmove == 1 then

selfMove(0)

end

if randmove == 2 then

selfMove(1)

end

if randmove == 3 then

selfMove(2)

end

if randmove == 4 then

selfMove(3)

end

end

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) > 3 then

selfSay('Good bye then.')

focus = 0

end

end

end

end

Valendo rep +

smite-1.png

Link para o post
Compartilhar em outros sites

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 ((string.find(msg, '(%a*)hi(%a*)')) and (focus == 0)) and getDistanceToCreature(cid) < 3 then

if getPlayerStorageValue(cid,853) < 1 then

selfSay('Ola ' .. creatureGetName(cid) .. 'bem-vindo ao NSWO e a Academia Shinobi, nela pode falar com varios "npcs" que poderao te "vender" itens e pode explorar "hunts" , ate que chegue a hora de "sair" da academia.')

focus = cid

talk_start = os.clock()

else

selfSay('Espere..')

focus = 0

  talk_start = 0

end

elseif string.find(msg, '(%a*)hi(%a*)') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then

  selfSay('Desculpe, ' .. creatureGetName(cid) .. '! Estou ocupado')

  elseif focus == cid then

talk_start = os.clock()


  if msgcontains(msg, 'npcs') and focus == cid then

  selfSay("NPC's são personagens controlado pelo computador que podem ter varias funções como vender itens , comprar itens , Dar informações , dar missões e muito mais. Pode falar com eles dizendo : \"hi\" e \"bye\" para dizer tchau")

  talk_start = os.clock()

  end

  if msgcontains(msg, 'npc') and focus == cid then

  selfSay("NPC's são personagens controlado pelo computador que podem ter varias funções como vender itens , comprar itens , Dar informações , dar missões e muito mais. Pode falar com eles dizendo : \"hi\" e \"bye\" para dizer tchau")

  talk_start = os.clock()

  end

  if msgcontains(msg, 'hunt') and focus == cid then

  selfSay('Hunts são lugares onde ficam os monstros ou os inimigos, nela você pode caçar com amigos, ganhar exp treinar e muito mais. Cada monstro tem sua experiencia e itens propios')

  talk_start = os.clock()

  end

  if msgcontains(msg, 'hunts') and focus == cid then

  selfSay('Hunts são lugares onde ficam os monstros ou os inimigos, nela você pode caçar com amigos, ganhar exp treinar e muito mais. Cada monstro tem sua experiencia e itens propios')

  talk_start = os.clock()

  end

  if msgcontains(msg, 'sair') and focus == cid then

  selfSay('Bom , para sair da academia você pode ir pelo Leste , até chegar num porto onde o marinheiro poderá ajudar você se estiver pronto para ir !!')

  talk_start = os.clock()

  end

  if msgcontains(msg, 'ir') and focus == cid then

  selfSay('Bom , para sair da academia você pode ir pelo Leste , até chegar num porto onde o marinheiro poderá ajudar você se estiver pronto para ir !!')

  talk_start = os.clock()

  end


  if string.find(msg, '(%a*)bye(%a*)') and focus == cid and getDistanceToCreature(cid) < 3 then

  selfSay('Good bye, ' .. creatureGetName(cid) .. '!')

  focus = 0

  talk_start = 0

  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 focus == 0 then

randmove = math.random(1,50)

if randmove == 1 then

  selfMove(0)

end

if randmove == 2 then

  selfMove(1)

end

if randmove == 3 then

  selfMove(2)

end

if randmove == 4 then

  selfMove(3)

end

end

  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) > 3 then

selfSay('Good bye then.')

focus = 0

end

end

end

end

-"Supra Omnes Lux Lucis"

- Acima de todos brilha a Luz -

5VGnDyBz.png

Link para o post
Compartilhar em outros sites

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo