Hum.... o npc pode perguntar para a pessoa se ela quer ingles ou portugues?
Tipo voce fala hi e ele responde Hi, choose one linguage, portuguese or english?
Como tem que ser??
info
Grupo: Conde
Registrado: 09/09/09
Posts: 528
Reputação: +424
Char no Tibia: Emekalo Makalo

Hum.... o npc pode perguntar para a pessoa se ela quer ingles ou portugues?
Tipo voce fala hi e ele responde Hi, choose one linguage, portuguese or english?
Como tem que ser??
até dava, mas qual "greeting" ele iria responder?
Ex:
ae quer que eu fale português?want me to speak English?
ou
hi quer que eu fale português?want me to speak English?
tem esse problema da 1º greeting ao ser falada.
Editado Junho 21 por felzan
info
Grupo: Conde
Registrado: 09/09/09
Posts: 528
Reputação: +424
Char no Tibia: Emekalo Makalo

Kara para voce fazer com que o npc fale quando voce falar ae voce tem que ir em npc/lib/npcsystem e abrir o arquivo npcsystem.lua e aonde tiver:
FOCUS_GREETWORDS = {'hi', 'hello', 'hey'}
Voce bota o 'ae' ficando assim
FOCUS_GREETWORDS = {'hi', 'hello', 'hey', 'ae'}
Ai quando tu falar hi ou hello ou hey ou ae ele vai te responder.
Bem como voce nao deu as caracteristicas do npc entao fiz so um negocinho bobo aqui pra te dar exemplo:
Script.lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
if msgcontains(msg, "english") then
selfSay("Humm, good what you mean of bla bla bla?", cid)
talkState[cid] = 1
elseif msgcontains(msg, "good") and talkState[cid] == 1 then
selfSay("Oh, realy? Thanks", cid)
elseif msgcontains(msg, "bad") and talkState[cid] == 1 then
selfSay("Grrrr...", cid)
end
if msgcontains (msg, "portugues") then
selfSay("Humm, bom o que voce acha do bla bla bla?", cid)
talkState[cid] = 2
elseif msgcontains(msg, "bom") and talkState[cid] == 2 then
selfSay("Oh, verdade? Obrigado.", cid)
elseif msgcontains(msg, "ruim") and talkState[cid] == 2 then
selfSay("Grrrr...", cid)
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Npc.xml:
<npc name="NPC" script="data/npc/scripts/npc.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="134" head="78" body="88" legs="0" feet="88" addons="3"/>
<parameters>
<parameter key="message_greet" value="Hi |PLAYERNAME|. Quer que eu fale {portugues} or want me to speak {English}?." />
<parameter key="message_farewell" value="Bye." />
<parameter key="message_walkaway" value="Bye." />
</parameters>
</npc>
Editado Junho 22 por MatheusMkalo
Obrigado :button_ok:
Vlws, isso ja ajuda muito, vo testar pra ver se da certo.
aquela parte de adicionar uma greeting eu ja sabia... eu fucei de monte, xD
info
Grupo: Visconde
Registrado: 12/08/07
Posts: 345
Reputação: +7
Char no Tibia: Lokeded
Mano eu tava pensando nisso esses tempo atrás, só que para npc de missao, para facilitar os noob br
Tipo assim:
Player:
Hi
NPC:
Hi, first choice your language : English or Portuguese
Player(BR): Portuguese
Eae amigo, eu preciso de ajuda para uma certa missão ...blablabla
Player(OUTROS):English
Hey man, i need your help for a mission... blablabla
E quem sabe ainda não adicionar 3 linguas?
Portugues,Ingles e Espanhol
info
Grupo: Herói
Registrado: 17/02/08
Posts: 2.5k
Reputação: +193

Sanado - movido.
info
Grupo: Visconde
Registrado: 19/04/09
Posts: 279
Reputação: +64
Estou tentando fazer com os NPCs falem 2 línguas...
ex:
ja vi umas coisas na lib dos NPC e achei algo sobre a greet(saudação) que é hi eu queria adicionar mais uma greeting
eu ja tentei adicionar mais uma greeting duplicando a primeira e adicionando um 2 no final da palavra, tentei procurar todos os lugares em que a greeting faz referência e modificar, mas infelizmente sem sucesso, gostaria de pedir aos "experts" em scripting que me dissem como adicionar isso, as 2 opções de fala, pela lib ou mesmo pelo próprio script.
vlw