• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Npc not work

Dixtro

New Member
Joined
May 4, 2010
Messages
49
Reaction score
3
Location
Poland!
Hello I have problem 'couse when someone want to say : secret>yes
npc dont do anything ... (when say "secret" its work but when say "yes" npc dont do anything)
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 (not npcHandler:isFocused(cid)) then
        return false
    end
           if msgcontains(msg, 'gold newspaper') then
                npcHandler:say('OHH! You really have my goldnewspaper?!', cid)
                talk_state = 1
        elseif msgcontains(msg, 'yes') and talk_state == 1 then
            if getPlayerItemCount(cid,8981) >= 1 then
	       doPlayerRemoveItem(cid, 8981,1)
                npcHandler:say('Thanks! If you want know my {secret} ask me', cid)
                doPlayerSetStorageValue(cid, 35700, 1)
                talk_state = 0
            else
                npcHandler:say('Lets find my goldnewspaper first!', cid)
                talk_state = 0
            end
		elseif msgcontains(msg, 'secret') then
		    if getPlayerStorageValue(cid, 35700) == 1 then
                npcHandler:say('I lost my wife too can you give her this ring??', cid)
                talk_state = 2
        elseif msgcontains(msg, 'yes') and talk_state == 2 then
                    npcHandler:say('Good Luck!', cid)
                    doPlayerAddItem(cid, 10502, 1)
			        doPlayerSetStorageValue(cid, 35701,1)
                talk_state = 0
            else
                npcHandler:say('WHAT?! You cant know!', cid)
                talk_state = 0
            end
------------------------------------------------ confirm no ------------------------------------------------
        elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 3) then
            npcHandler:say('So dont waste my time!', cid)
            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())


Please help me. I be a greatful
 
Back
Top