• 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 Problem

deat

Intermediate OT User
Joined
May 25, 2008
Messages
30
Reaction score
101
Location
Poland
Npc not responded on "yes". Where is error this script?


PHP:
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 say(param)
            npcHandler:say(param.text,param.cid)
         end
    function delayedSay(text, delay, cid)
    if(not npcHandler:isFocused(cid)) then
                return FALSE
     else
         local param = {cid = cid, text = text}
            local delay = delay or 0
            local cid = cid or 0
            local nid = getNpcCid()
            addEvent(say, delay, param)
        end
    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
local TALKDELAY_ONTHINK = 1    
    str1 = getPlayerStorageValue(cid,2001)
    str2 = getPlayerStorageValue(cid,2002)
    str3 = getPlayerStorageValue(cid,2003)
    str4 = getPlayerStorageValue(cid,2004)
    str5 = getPlayerStorageValue(cid,2005)
    str6 = getPlayerStorageValue(cid,2006)
    str7 = getPlayerStorageValue(cid,2007)
    str8 = getPlayerStorageValue(cid,2008)
    str9 = getPlayerStorageValue(cid,2009)
    str10 = getPlayerStorageValue(cid,2010)
    str11 = getPlayerStorageValue(cid,2010)
if msgcontains(msg, 'quest') or  msgcontains(msg, 'mission') then
    if getPlayerStorageValue(cid, 10020) == -1 then
    delayedSay('I hope your first mission will not scare you off. Even though, we cut off our sewer system from other parts of the city to prevent the worst, it still has deteriorated in the last decades. ... ', 100,cid)
    delayedSay('Certain parts of the controls are rusty and the drains are stuffed with garbage. Get yourself a crowbar, loosen the controls and clean the pipes from the garbage. ... ', 1100,cid)
    delayedSay('We were able to locate the 4 worst spots in the sewers. I will mark them for you on your map so you have no trouble finding them. Report to me when you have finished your mission. ... ', 2000,cid)
    setPlayerStorageValue(cid, 2000, 1)  
    setPlayerStorageValue(cid, 10020, 1)
elseif getPlayerStorageValue(cid, 10020) == 1 then
    selfSay('So are you done with your work?', cid)
    talk_state = 1
elseif getPlayerStorageValue(cid, 10020) == 2 then
    delayedSay("We are still present at each quarter's city wall, even though we can do little to stop the chaos from spreading. Still, our garrisons are necessary to maintain some sort of order in the city. ...  ", 100,cid)
    delayedSay("My superiors ask for a first hand report about the current situation in the single city quarters. I need someone to travel to our garrisons to get the reports from the guards. Are you willing to do that? ", 1100,cid)
    talk_state = 2
elseif getPlayerStorageValue(cid, 10020) == 3 then
    selfSay('Did you get all the reports my superiors asked for?', cid)
    talk_state = 3
elseif getPlayerStorageValue(cid, 10020) == 4 then
    delayedSay("I did my best to impress my superiors with your accomplishments and it seems that it worked quite well. They want you for their own missions now. ...", 100,cid)
    delayedSay("Missions that are more important than the ones you've fulfilled for me. However, before you leave, there are still some things I need to tell you. ...", 1100,cid)
    delayedSay("Listen, I can't explain you everything in detail right now and here. You never know who might be eavesdropping. ... ", 2000,cid)
    delayedSay("I left some notes in the small room there. Get them and read them. Talk to me again when you've read the notes. ", 3000,cid)
    setPlayerStorageValue(cid, 10017, 1) 
    setPlayerStorageValue(cid, 10020, 5)
elseif getPlayerStorageValue(cid, 10020) == 5 then
    if getPlayerItemCount(cid,1954) >= 2 then
    delayedSay("Now you know as much as we do about the things happening in Yalahar. It's up to you what you do with this information. ... ", 100,cid)
    delayedSay("Now leave and talk to my superior Azerus in the city centre to get your next mission. I urge you, though, to talk to me whenever he sends you on a new mission. ...", 1100,cid)
    delayedSay("I think it is important that you hear my opinion about them. Now hurry. I suppose Azerus is already waiting.", 2000,cid)
    setPlayerStorageValue(cid, 7055, 1) 
    setPlayerStorageValue(cid, 10020, 6)
elseif getPlayerStorageValue(cid, 10020) == 6 then
    selfSay('Did you get all the reports my superiors asked for?', cid)
    talk_state = 0
end
elseif talk_state == 1 then
if msgcontains(msg, 'yes') then
    if str1 == 1 and str2 == 1 and str3 == 1 and str4 == 1 then
    selfSay("Thank you very much. You have no idea how hard it was to find someone volunteering for that job. If you feel ready for further missions, just tell me.", cid)
    setPlayerStorageValue(cid, 10020, 2)  
    else
    selfSay("You are no repair", cid)    
    end
    elseif msgcontains(msg, 'no') then
    selfSay('Maybe later.')
end
 elseif talk_state == 2 then
if msgcontains(msg, 'yes') then
    delayedSay("I must warn you, the quarters are in a horrible state. I strongly advise you to stay on the main roads whenever possible while you get those reports. ... ", 100,cid)
    delayedSay("You'll find our seven guards at the gates of each quarter. Just ask them for their report and they will tell you all you need to know.", 1100,cid)
    setPlayerStorageValue(cid, 10018, 1) 
    setPlayerStorageValue(cid, 10020, 3)
    end  
elseif msgcontains(msg, 'no') then
    selfSay('Maybe later.')
end
elseif talk_state == 3 then
    if msgcontains(msg, 'yes') then
    if str5 == 1 and str6 == 1 and str7 == 1 and str8 == 1 and str9 == 1 and str10 == 1 and str11 == 1 then
    npcHandler:say("Excellent! My superiors will be pleased to get these reports. I will for sure emphasise your efforts in this mission. Please come back soon to see if there are any moremissions available for you. ", cid)
    setPlayerStorageValue(cid, 10020, 4)
    else
    selfSay('Sorry, you dont bring all raports.', cid)
    end 
    elseif msgcontains(msg, 'no') then
    selfSay('Maybe later.')
end
end
talk_state = 0
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Back
Top Bottom