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

deamon123

New Member
Joined
Mar 9, 2008
Messages
38
Reaction score
0
I would need exemplar as make NPC Quest which could open after all door door Id = 1257

THx
 
I made this one quite fast but I think it should work :p

NOTE:You have to put Action ID '7539' on all quest doors you want to be able to pass when you have done the quest.
Code:
local talkNode = 0

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

-- OTServ event handling functions start
function onCreatureSay(cid, type, msg)                             npcHandler:onCreatureSay(cid, type, msg) end
function onThingMove(creature, thing, oldpos, oldstackpos)                 npcHandler:onThingMove(creature, thing, oldpos, oldstackpos) end
function onCreatureAppear(creature)                             npcHandler:onCreatureAppear(creature) end
function onCreatureDisappear(id)                             npcHandler:onCreatureDisappear(id) end
function onCreatureTurn(creature)                             npcHandler:onCreatureTurn(creature) end
function onCreatureChangeOutfit(creature)                         npcHandler:onCreatureChangeOutfit(creature) end
function onThink()                                     npcHandler:onThink() end
-- OTServ event handling functions end


local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)
        
function creatureSayCallback(cid, type, msg)
    if(npcHandler.focus ~= cid) then
        return false
    end

    local queststatus = getPlayerStorageValue(cid, 7539)

-- getmission --        
    if msgcontains(msg, 'mission') then
        if queststatus < 1 then
            npcHandler:say("Do you want to join the post service?")
            talkNode = 1   
    end
end
-- Confirm yes --
    if msgcontains(msg, 'yes') then
        if talkNode == 1 then
            if queststatus < 1 then
                npcHandler:say("Welcome in!")
                setPlayerStorageValue(cid, 7539, 1)
                focus = 0
                talkNode = 0
            else
                npcHandler:say("Get lost!")
    end
end

-- Confirm no --
    if msgcontains(msg, 'no') then
        if talkNode == 1 then
            selfSay('Come back when you have grown up!')
            talk_state = 0
    end
    
   end
    return TRUE
end
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
-- Makes sure the npc reacts when you say hi, bye etc.
npcHandler:addModule(FocusModule:new())
 
Back
Top