Ir para conteúdo

Featured Replies

Postado
Agora, peterson18 disse:

No caso eu estava tentando que o NPC disse o nome do player

Ele teria que buscar o nome

Exemplo: 


Olá, como está Skydrows, faz tempo que não aparece por aqui... Em que posso lhe ajudar?

 

Por que você não usa o |PLAYERNAME|?

Master yourself, master the enemy.

  • Respostas 13
  • Visualizações 1.2k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • A função retorna uma string, ou seja, um texto. Para fazer essa comparação corretamente, o nome a ser comparado também tem que ser uma string. local keywordHandler = KeywordHandler:new() local npc

  • local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:onCre

  • @peterson18 está quase, faltou remover o if desnecessário   acredito que a versão correta do script seria assim:   local keywordHandler = KeywordHandler:new() local npcHandler = Npc

Postado

Você pode fazer isso por lua também, basta adicionar um addGreetKeyword ou setMessage(MESSAGE_GREET, text)

Vou te mandar os dois exemplos.

 


-- Greeting 
keywordHandler:addGreetKeyword({'hi'}, {npcHandler = npcHandler, text = 'Hello, |PLAYERNAME|! You are looking really bad. Let me heal your wounds. It\'s my job after all.'},

)

Essa é por keyword

 

local function greetCallback(cid)
	local player = Player(cid)
	
	if player:getVocation():getId() == 1 then
		npcHandler:setMessage(MESSAGE_GREET, "Well, well, a new sorcerer! Want me to bring you somewhere nice?")
	elseif player:getVocation():getId() == 2 then
		npcHandler:setMessage(MESSAGE_GREET, "Well, well, a new druid! Want me to bring you somewhere nice?")
	elseif player:getVocation():getId() == 3 then
		npcHandler:setMessage(MESSAGE_GREET, "Well, well, a new paladin! Want me to bring you somewhere nice?")
	elseif player:getVocation():getId() == 4 then
		npcHandler:setMessage(MESSAGE_GREET, "Well, well, a new knight! Want me to bring you somewhere nice?")
	end
	npcHandler:addFocus(cid)
	return true
end

Essa é por setMessage(nessa aqui é mais fácil de adicionar condições, como no exemplo de vocações mesmo)

Editado por Skydrowz (veja o histórico de edições)

Master yourself, master the enemy.

Postado
  • Autor
28 minutos atrás, Skydrowz disse:

Você pode fazer isso por lua também, basta adicionar um addGreetKeyword ou setMessage(MESSAGE_GREET, text)

Vou te mandar os dois exemplos.

 



-- Greeting 
keywordHandler:addGreetKeyword({'hi'}, {npcHandler = npcHandler, text = 'Hello, |PLAYERNAME|! You are looking really bad. Let me heal your wounds. It\'s my job after all.'},

)

Essa é por keyword

 


local function greetCallback(cid)
	local player = Player(cid)
	
	if player:getVocation():getId() == 1 then
		npcHandler:setMessage(MESSAGE_GREET, "Well, well, a new sorcerer! Want me to bring you somewhere nice?")
	elseif player:getVocation():getId() == 2 then
		npcHandler:setMessage(MESSAGE_GREET, "Well, well, a new druid! Want me to bring you somewhere nice?")
	elseif player:getVocation():getId() == 3 then
		npcHandler:setMessage(MESSAGE_GREET, "Well, well, a new paladin! Want me to bring you somewhere nice?")
	elseif player:getVocation():getId() == 4 then
		npcHandler:setMessage(MESSAGE_GREET, "Well, well, a new knight! Want me to bring you somewhere nice?")
	end
	npcHandler:addFocus(cid)
	return true
end

Essa é por setMessage(nessa aqui é mais fácil de adicionar condições, como no exemplo de vocações mesmo)


Legal, não sabia dessas funções!

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

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Conteúdo Similar

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo