Whats wrong with it? He ain't replying when I say hi.. no errors displayed.
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)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
function doNPCTalkALot(msgs,interval,pcid)
local e={}
local ret={}
if interval==nil then interval=10000 end --10 seconds is default time between messages
for aux=1,table.getn(msgs) do
e[aux]={}
doCreatureSayWithDelay(getNpcCid(),msgs[aux],TALKTYPE_PRIVATE_NP,(aux-1)*interval,e[aux],pcid)
table.insert(ret,e[aux])
end
return(ret)
end
if msgcontains(msg, 'hi') then
selfsay("Greetings, player. I do not see your face, but I can read a thousand things in your voice!")
talkState[talkUser] = 1
elseif talkState[talkUser] == 1 then
if msgcontains(msg, 'word of greeting') and getPlayerStorageValue(cid,35000) == -1 then
doNPCTalkALot({"The djinns have an ancient code of honour. This code includes a special concept of hospitality. Anybody who utters the word of greeting must not be attacked even if he is an enemy. Well, at least that is what the code says. .... ...", "I have found out, though, that this does not work at all times. There is no point to say the word of greeting to an enraged djinn. .... ...", "I can tell you the word of greeting if you're interested. It is DJANNI'HAH. Remember this word well, stranger. It might save your life one day. .... ...", "And keep in mind that you must choose sides in this conflict. You can only follow the Efreet or the Marid - once you have made your choice there is no way back. I know from experience that djinn do not tolerate double-crossing.."}, 5000, cid)
setPlayerStorageValue(cid,35000,1)
talkState[talkUser] = 2
elseif msgcontains(msg, 'bye') then
selfsay('Farewell, stranger. May Uman the Wise guide your steps in this treacherous land.')
elseif talkState[talkUser] == 1 then
if msgcontains(msg, 'word of greeting') and getPlayerStorageValue(cid,35000) == 1 then
selfsay("Go and choose a side, I've already told you the word!")
end
end
end
return true
end