Ue...
Não deu certo e nem consegui entendi porque...
Fiz um script para testar e ficou assim...
Teste.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<npc name="Teste" script="Teste.lua" walkinterval="0" floorchange="0">
<health now="100" max="100"/>
<look typeex="1448"/>
</npc>
Teste.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)
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
local msg = string.lower(msg)
local salutMsgs = {"Hello, mage of the skies.","Hello my forest enchanter.","Hey! Super shooter ..","Aye, guardian."}
local vocNoPromo = getPlayerVocation(cid) - (4 * getPlayerPromotionLevel(cid))
if(msgcontains(msg, 'hi')) then
selfSay(salutMsgs[vocNoPromo], cid)
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Mas quando eu falo hi ele diz isto:
19:42 Teste: Olá, Gustavo! O que o traz aqui?