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 if msgcontains(msg, 'repair soft boots') then selfSay('Did you bring me your worn soft boots?. I\'ll repair them for you.') talk_state = 1 elseif msgcontains(msg, 'yes') and talk_state == 1 then if getPlayerItemCount(cid,6530) >= 1 and getPlayerItemCount(cid,2152) >= 100 then if doPlayerTakeItem(cid,6530,1) == 0 and doPlayerItemCount(cid,2152) >= 100 the selfSay('Here you are.') doPlayerAddItem(cid,2640,1) end else selfSay('Sorry, I only repair worn soft boots for 10k.') end elseif msgcontains(msg, 'no') and talk_state == 1 then selfSay('Ok than.') 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())