hi guys, today I tried my npc pack on the latest tfs. Somehow my npc dont answer anymore. Can anybody give me a hint or solution please
Would be nice, thx.
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
-- OTServ event handling functions start
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
-- OTServ event handling functions end
function creatureSayCallback(cid, type, msg)
-- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
if(npcHandler.focus ~= cid) then
return false
end
-- use the real conversation? (true/false)
real = false
if real == true then
else
hasNoMsg = 'You don\'t even have that item!'
noMsg = 'Then not.'
combMsg = 'I might trade a demon armor for a mermaid comb.'
end
if msgcontains(msg, 'No') then
selfSay(noMsg)
talk_state = 1
elseif msgcontains(msg, 'mermaid') then
selfSay(combMsg)
talk_state = 2
------------------------------------------------ confirm yes ------------------------------------------------
elseif msgcontains(msg, 'yes') and talk_state == 2 then
if getPlayerItemCount(cid,2494) >= 1 then
if doPlayerTakeItem(cid,2494,1) == 0 then
selfSay('Here you are.')
doPlayerAddItem(cid,5945,1)
end
else
selfSay(hasNoMsg)
end
talk_state = 0
------------------------------------------------ confirm no ------------------------------------------------
elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 5) then
selfSay(noMsg)
talk_state = 0
end
-- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Would be nice, thx.