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

Lua NPC Script Help

Kodak

Member
Joined
Jun 7, 2007
Messages
36
Reaction score
6
Wrote this script, but the NPC is not responding to 'mission' - confirmed storage 50,1 on testing player. Any suggestions?

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

npcHandler:addModule(FocusModule:new())

local FirstImpressions = 50

function creatureSayCallback(cid, type, msg)
    if(not npcHandler:isFocused(cid)) then
        return false
    end

    local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
    if(msgcontains(msg, 'mission'))  then
                 if getPlayerStorageValue(cid, FirstImpressions) == -1 then
                 selfSay("Oh I see you are new here, would you like a little help?", cid)
                 talkState[talkUser] = 1
             elseif getPlayerStorageValue(cid, FirstImpressions) == 1 then
                 selfSay("Oh did Prophet Mobomba send you over here?", cid)
                 talkState[talkUser] = 1
             else
                 selfSay("I do not have anything else right now.", cid)
             end
             npcHandler:addFocus(cid)
         else
             return false
         end


     if msgcontains(msg, "yes") and talkState[talkUser] == 1 then
         if getPlayerStorageValue(cid, FirstImpressions) == -1 then
             selfSay("Alright here you go. You might go talk to Frodo over at his food hut, he came with me here from Thais, along with Hanna.", cid)
             setPlayerStorageValue(cid, FirstImpressions, 2)
             doPlayerAddItem(cid, 5908, 1)
             doPlayerAddExp(cid, 250)
         else
               if getPlayerStorageValue(cid, FirstImpressions) == 1 then
                selfSay("He is a special fellow. Well you must be new, here is something to help you out. You might talk Frodo for some more stuff.", cid)
                setPlayerStorageValue(cid, FirstImpressions, 2)
                 doPlayerAddItem(cid, 5908, 1)
                 doPlayerAddExp(cid, 250)
             else
                 selfSay("Sorry, I have given all I can spare.", cid)
             end
         end
         talkState[talkUser] = 0
     elseif msgcontains(msg, "no") and talkState[talkUser] == 1 then
         selfSay("Ok then.", cid)
         talkState[talkUser] = 0
     elseif msgcontains(msg, "bye") then
         selfSay("Bye.", cid)
         npcHandler:releaseFocus(cid)
     end
     return true
end
 
Back
Top