• 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 don't react to my keywords ...

Slayernight

New Member
Joined
Sep 15, 2008
Messages
17
Reaction score
0
Hello folks,

I've got a problem with this NPC :
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

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) 
    if(npcHandler.focus ~= cid) then 
        return false 
    end 

if msgcontains(msg, 'rumors') or msgcontains(msg, 'rumor') or msgcontains(msg, 'mission') or msgcontains(msg, 'quest') or msgcontains(msg, 'lost') then
    
	if getPlayerStorageValue(cid, 50005) == -1 then
	selfSay('Rumors, quest ??? What are you talking about ?... I did not lost everything...')
		
	elseif (getPlayerStorageValue(cid, 50005) == 1 and getPlayerStorageValue(cid, 50006) == -1) then
	selfSay('Ahh... you also heard about it... Well, it\'s too late! Spiders are way too big down there now! You want to go down there?')
	talk_state = 1642

	elseif (getPlayerStorageValue(cid, 50006) == 1 and getPlayerStorageValue(cid, 50007) == -1) then
	selfSay('And, spiders a big uh!')
	
	elseif getPlayerStorageValue(cid, 50007) == 1 then
	selfSay('You got it for real??? Woah !!! You are strong...')
	
	end

elseif talk_state == 1642 then

	if msgcontains(msg, 'yes') then
	    selfSay('Alright, take this key to unlock the chest.')
		local key = doPlayerAddItem(cid, 2090, 1)
		doSetItemActionId(key, 50006)
	    setPlayerStorageValue(cid, 50006, 1)
		
	elseif msgcontains(msg, 'no') then
	    selfSay('Then not.')
	end
end
talk_state = 0
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

It doesn't react to my keywords...

Please help me!
 
::: EDIT :::

Ok, Now my NPC answer when I say my keywords.
But OI got another problem:
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

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) 
    if(not npcHandler:isFocused(cid)) then
        return false
    end

if msgcontains(msg, 'rumors') or msgcontains(msg, 'rumor') or msgcontains(msg, 'mission') or msgcontains(msg, 'quest') or msgcontains(msg, 'lost') then
    
	if getPlayerStorageValue(cid, 50005) == -1 then
	selfSay('Rumors, quest ??? What are you talking about ?... I did not lost everything...', cid)
		
	elseif (getPlayerStorageValue(cid, 50005) == 1 and getPlayerStorageValue(cid, 50006) == -1) then
	selfSay('Ahh... you also heard about it... Well, it\'s too late! Spiders are way too big down there now! You want to go down there?', cid)
	talk_state = 1642

	elseif (getPlayerStorageValue(cid, 50006) == 1 and getPlayerStorageValue(cid, 50007) == -1) then
	selfSay('And, spiders a big uh!')
	
	elseif getPlayerStorageValue(cid, 50007) == 1 then
	selfSay('You got it for real??? Woah !!! You are strong...')
	
	end
elseif talk_state == 1642 then
	if msgcontains(msg, 'yes') then
	    selfSay('Alright, take this key to unlock the chest.')
		local key = doPlayerAddItem(cid, 2090, 1)
		doSetItemActionId(key, 50006)
	    setPlayerStorageValue(cid, 50006, 1)
		
	elseif msgcontains(msg, 'no') then
	    selfSay('Then not.')
	end
end
talk_state = 0
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Now my problem is around the talk_state.
I say "yes" after :
Code:
elseif (getPlayerStorageValue(cid, 50005) == 1 and getPlayerStorageValue(cid, 50006) == -1) then
	selfSay('Ahh... you also heard about it... Well, it\'s too late! Spiders are way too big down there now! You want to go down there?', cid)
	talk_state = 1642
And my NPC does nothing.

Help please, ty for your fast replies !
 
Last edited:
Ok, now it works as it should.

But, still I got another problem... I think it's a little one :p

Code:
local key = doPlayerAddItem(cid, 2090, 1)
doSetItemActionId(key, 5006)
setPlayerStorageValue(cid, 50006, 1)

I got this error :
Code:
lua:DoSetItemActionId() Item not found.

I made like everybody do but it don't work.
 
Back
Top