Postado Junho 9, 2018 7 anos 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.
Postado Junho 9, 2018 7 anos Autor Agora, Skydrowz disse: Por que você não usa o |PLAYERNAME|? Esse ai só funciona no .xml não é? Eu estava querendo que funcionasse no .lua do NPC
Postado Junho 9, 2018 7 anos 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 Junho 9, 2018 7 anos por Skydrowz (veja o histórico de edições) Master yourself, master the enemy.
Postado Junho 9, 2018 7 anos 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.