• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

You can't do this quest until you have done the first quest

Kisskotte

New Member
Joined
May 26, 2008
Messages
60
Reaction score
1
Hello I wonder if you can do like a chain quest like If you have done quest 1 with storage 20000 you are now able to continue do the next quest?

Here is the code !

Quest2.lua
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
 
item = 'You do not have the required items.'
done = 'Here you are.'
 
function creatureSayCallback(cid, type, msg)
	if(not npcHandler:isFocused(cid)) then
		return false
	end
 
		if msgcontains(msg, 'help') then
	        queststatus = getPlayerStorageValue(cid,20001)
		if queststatus == -1 then
		selfSay('My men and I was attacked by the orcs west from here at the mountain they killed all my men leaving just me alive. I want you to kill there Shaman so we can create a portal to his ring. When he is killed go through the teleport and grab the {ring} of death and use the portal to get back to me agian and you will be greatly rewarded', cid)
			else
				selfSay('You have alredy done this quest or you hasent done the requierd quest to do this one.', cid)
			end
 
 
			elseif msgcontains(msg, 'ring') then
			if getPlayerItemCount(cid,6300) >= 1 then
				selfSay('Great I see that you have the ring! Can I have it?', cid)
				talk_state = 2
			else
				selfSay('Ehh... are you trying to fool me?', cid)
				talk_state = 0
			end
 
			elseif msgcontains(msg, 'yes') and talk_state == 2 then
			talk_state = 0
			if getPlayerItemCount(cid,6300) >= 1 then
			if doPlayerRemoveItem(cid,6300, 1) == TRUE then
							selfSay('Yes the ring is mine thank you for your help please go south from here and find my brother Stan.', cid)
			doPlayerAddItem(cid, 2152, 10)
			doPlayerAddExp(cid, 9000)
	                setPlayerStorageValue(cid,20001,1)
			end
			else
				selfSay(item, cid)
			end
 
        elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 5) then
            selfSay('Fool! Stop wasting my time then!')
            talk_state = 0
        end
    -- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
    return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Just change this
LUA:
	if queststatus == -1 then

to this
LUA:
	if queststatus == 1 then

== 1 means if the player already did the quest.

Example
LUA:
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
 
item = 'You do not have the required items.'
done = 'Here you are.'
 
function creatureSayCallback(cid, type, msg)
	if(not npcHandler:isFocused(cid)) then
		return false
	end
 
		if msgcontains(msg, 'help') then
	        queststatus = getPlayerStorageValue(cid,20001)
	        queststatuss = getPlayerStorageValue(cid,20000)
		if queststatus == -1 and queststatuss == 1 then
		selfSay('My men and I was attacked by the orcs west from here at the mountain they killed all my men leaving just me alive. I want you to kill there Shaman so we can create a portal to his ring. When he is killed go through the teleport and grab the {ring} of death and use the portal to get back to me agian and you will be greatly rewarded', cid)
			else
				selfSay('You have alredy done this quest or you hasent done the requierd quest to do this one.', cid)
			end
 
 
			elseif msgcontains(msg, 'ring') then
			if getPlayerItemCount(cid,6300) >= 1 then
				selfSay('Great I see that you have the ring! Can I have it?', cid)
				talk_state = 2
			else
				selfSay('Ehh... are you trying to fool me?', cid)
				talk_state = 0
			end
 
			elseif msgcontains(msg, 'yes') and talk_state == 2 then
			talk_state = 0
			if getPlayerItemCount(cid,6300) >= 1 then
			if doPlayerRemoveItem(cid,6300, 1) == TRUE then
							selfSay('Yes the ring is mine thank you for your help please go south from here and find my brother Stan.', cid)
			doPlayerAddItem(cid, 2152, 10)
			doPlayerAddExp(cid, 9000)
	                setPlayerStorageValue(cid,20001,1)
			end
			else
				selfSay(item, cid)
			end
 
        elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 5) then
            selfSay('Fool! Stop wasting my time then!')
            talk_state = 0
        end
    -- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
    return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

20000 is here the storage of the previous quest.
 
Last edited:
Back
Top