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

Mission npc

kamilcioo

Veteran OT User
Joined
Jul 25, 2008
Messages
979
Solutions
1
Reaction score
291
Here is mission npc. I want to do if player doesnt have finished first mission he cant take second mission and if he doesnt have second mission done he cant take third mission.


Code:
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
if(msgcontains(msg, 'quest')) then
selfSay('Ok, you can started "first mission"?', cid)
end
---------------------------------------------------------
if(msgcontains(msg, 'first mission')) then
selfSay('Please bring me 10 "meat"', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'meat') and talkState[talkUser] == 1) then
if (getPlayerStorageValue(cid,100) > 0) then
selfSay('You finished this mission.', cid)
else
if(doPlayerRemoveItem(cid, 2666, 10) == TRUE) then
setPlayerStorageValue(cid,100,1)
doPlayerAddExperience(cid,1000)
selfSay('Thank you! You can started "second mission".. (you received 1000 points of experience)', cid)
else
selfSay('You must have more items', cid)
end
end
return true
end
---------------------------------------------------------
if(msgcontains(msg, 'second mission')) then
selfSay('Please bring me 10 "ham"', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'ham') and talkState[talkUser] == 1) then
if (getPlayerStorageValue(cid,101) > 0) then
selfSay('You finished this mission.', cid)
else
if(doPlayerRemoveItem(cid, 2671, 10) == TRUE) then
setPlayerStorageValue(cid,101,1)
doPlayerAddExperience(cid,1000)
selfSay('Thank you! You can started "third mission".. (you received 1000 points of experience)', cid)
else
selfSay('You must have more items', cid)
end
end
return true
end
---------------------------------------------------------
if(msgcontains(msg, 'third mission')) then
selfSay('Please bring me 20 "ham"', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'ham') and talkState[talkUser] == 1) then
if (getPlayerStorageValue(cid,102) > 0) then
selfSay('You finished this mission.', cid)
else
if(doPlayerRemoveItem(cid, 2671, 20) == TRUE) then
setPlayerStorageValue(cid,102,1)
doPlayerAddExperience(cid,1000)
selfSay('Thank you! You finished all missions. (you received 1000 points of experience)', cid)
else
selfSay('You must have more items', cid)
end
end
return true
end


end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Try, Rep++
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)
local storage = 2291
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if(msgcontains(msg, 'quest')) then
selfSay('Ok, you can started "first mission"?', cid)
end
---------------------------------------------------------
if(msgcontains(msg, 'first mission')) then
	if getPlayerStorageValue(cid,2291) == -1 then
	selfSay('Please bring me 10 "meat"', cid)
	talkState[talkUser] = 1
	end
elseif(msgcontains(msg, 'meat') and talkState[talkUser] == 1) then
if (getPlayerStorageValue(cid,100) > 0) then
selfSay('You have already finished this mission.', cid)
else
if(doPlayerRemoveItem(cid, 2666, 10) == TRUE) then
setPlayerStorageValue(cid,100,1)
doPlayerAddExperience(cid,1000)
setPlayerStorageValue(cid,2291,1)
selfSay('Thank you! You can start "second mission".. (you received 1000 points of experience)', cid)
else
selfSay('You must have more items', cid)
end
end
return true
end
---------------------------------------------------------
if(msgcontains(msg, 'second mission')) then
	if getPlayerStorageValue(cid,2291) == 1 then
	selfSay('Please bring me 10 "ham"', cid)
	talkState[talkUser] = 1
	else
	selfSay('Make first mission first!', cid)
	end
elseif(msgcontains(msg, 'ham') and talkState[talkUser] == 1) then
if (getPlayerStorageValue(cid,101) > 0) then
selfSay('You finished this mission.', cid)
else
if(doPlayerRemoveItem(cid, 2671, 10) == TRUE) then
setPlayerStorageValue(cid,101,1)
doPlayerAddExperience(cid,1000)
setPlayerStorageValue(cid,2291,2)
selfSay('Thank you! You can started "third mission".. (you received 1000 points of experience)', cid)
else
selfSay('You must have more items', cid)
end
end
return true
end
---------------------------------------------------------
if(msgcontains(msg, 'third mission')) then
	if getPlayerStorageValue(cid,2291) == 2 then
	selfSay('Please bring me 20 "ham"', cid)
	talkState[talkUser] = 1
	else
	selfSay('Make second mission first!', cid)
	end
elseif(msgcontains(msg, 'ham') and talkState[talkUser] == 1) then
if (getPlayerStorageValue(cid,102) > 0) then
selfSay('You finished this mission.', cid)
else
if(doPlayerRemoveItem(cid, 2671, 20) == TRUE) then
setPlayerStorageValue(cid,102,1)
doPlayerAddExperience(cid,1000)
setPlayerStorageValue(cid,2291,3)
selfSay('Thank you! You finished all missions. (you received 1000 points of experience)', cid)
else
selfSay('You must have more items', cid)
end
end
return true
end


end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Can you do this on it? Btw when i rep you it's say You must spread some Reputation around before giving it to Sonical again.

Code:
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)
local storage = 29000
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if(msgcontains(msg, 'quest')) then
selfSay('Ok, I have 9 missions for you.', cid)
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if(msgcontains(msg, 'first information')) then
selfSay('You can get red feather from {Flaming Bird}.', cid)
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if(msgcontains(msg, 'flaming bird')) then
selfSay('A bird which rose like a phoenix from the ashes. Some people are saying Fenix about him.', cid)
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if(msgcontains(msg, 'second information')) then
selfSay('You can get bean from Bean {Kid}.', cid)
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if(msgcontains(msg, 'kid')) then
selfSay('A kid which was killed by bean and now return.', cid)
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if(msgcontains(msg, 'third information')) then
selfSay('You can get parchment from {Old Monk Boss}.', cid)
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if(msgcontains(msg, 'old monk boss')) then
selfSay('Powerfull monster which own all {Old Monks}.', cid)
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if(msgcontains(msg, 'old monks')) then
selfSay('These monsters from thousands of years serve for {Old Monk Boss}.', cid)
end
---------------------------------------------------------
if(msgcontains(msg, 'first mission')) then
if getPlayerStorageValue(cid,29000) == -1 then
selfSay('Please bring me 25 {red feather}. For more informations say {first information}.', cid)
talkState[talkUser] = 1
	end
elseif(msgcontains(msg, 'red feather') and talkState[talkUser] == 1) then
if (getPlayerStorageValue(cid,19000) > 0) then
selfSay('You finished this mission.', cid)
else
if(doPlayerRemoveItem(cid, 12601, 25) == TRUE) then
setPlayerStorageValue(cid,19000,1)
doPlayerAddExperience(cid,4000000)
setPlayerStorageValue(cid,29000,1)
selfSay('Thank you! You can start {second mission}. (you received 4 milion points of experience)', cid)
else
selfSay('You must have more items', cid)
end
end
return true
end
---------------------------------------------------------
if(msgcontains(msg, 'second mission')) then
if getPlayerStorageValue(cid,29000) == -1 then
selfSay('Please bring me 50 {bean}. For more informations say {second information}.', cid)
talkState[talkUser] = 1
	else
	selfSay('Make {first mission} first!', cid)
	end
elseif(msgcontains(msg, 'bean') and talkState[talkUser] == 1) then
if (getPlayerStorageValue(cid,19001) > 0) then
selfSay('You finished this mission.', cid)
else
if(doPlayerRemoveItem(cid, 12600, 50) == TRUE) then
setPlayerStorageValue(cid,19001,1)
doPlayerAddExperience(cid,7000000)
setPlayerStorageValue(cid,29000,2)
selfSay('Thank you! You can started {third mission}. (you received 7 milion points of experience)', cid)
else
selfSay('You must have more items', cid)
end
end
return true
end
---------------------------------------------------------
if(msgcontains(msg, 'third mission')) then
selfSay('Please bring me one {parchment}. For more informations say {third information}.', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'parchment') and talkState[talkUser] == 1) then
if (getPlayerStorageValue(cid,19002) > 0) then
selfSay('You finished this mission.', cid)
else
if(doPlayerRemoveItem(cid, 12427, 1) == TRUE) then
setPlayerStorageValue(cid,19002,1)
doPlayerAddExperience(cid,10000000)
selfSay('Thank you! You can started {fourth mission}. (you received 10 milion points of experience)', cid)
else
selfSay('You dont have this item', cid)
end
end
return true
end
 
Try, Rep++
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)
local storage = 2291
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if(msgcontains(msg, 'quest')) then
selfSay('Ok, you can started "first mission"?', cid)
end
---------------------------------------------------------
if(msgcontains(msg, 'first mission')) then
	if getPlayerStorageValue(cid,2291) == -1 then
	selfSay('Please bring me 10 "meat"', cid)
	talkState[talkUser] = 1
	end
elseif(msgcontains(msg, 'meat') and talkState[talkUser] == 1) then
if (getPlayerStorageValue(cid,100) > 0) then
selfSay('You have already finished this mission.', cid)
else
if(doPlayerRemoveItem(cid, 2666, 10) == TRUE) then
setPlayerStorageValue(cid,100,1)
doPlayerAddExperience(cid,1000)
setPlayerStorageValue(cid,2291,1)
selfSay('Thank you! You can start "second mission".. (you received 1000 points of experience)', cid)
else
selfSay('You must have more items', cid)
end
end
return true
end
---------------------------------------------------------
if(msgcontains(msg, 'second mission')) then
	if getPlayerStorageValue(cid,2291) == 1 then
	selfSay('Please bring me 10 "ham"', cid)
	talkState[talkUser] = 1
	else
	selfSay('Make first mission first!', cid)
	end
elseif(msgcontains(msg, 'ham') and talkState[talkUser] == 1) then
if (getPlayerStorageValue(cid,101) > 0) then
selfSay('You finished this mission.', cid)
else
if(doPlayerRemoveItem(cid, 2671, 10) == TRUE) then
setPlayerStorageValue(cid,101,1)
doPlayerAddExperience(cid,1000)
setPlayerStorageValue(cid,2291,2)
selfSay('Thank you! You can started "third mission".. (you received 1000 points of experience)', cid)
else
selfSay('You must have more items', cid)
end
end
return true
end
---------------------------------------------------------
if(msgcontains(msg, 'third mission')) then
	if getPlayerStorageValue(cid,2291) == 2 then
	selfSay('Please bring me 20 "ham"', cid)
	talkState[talkUser] = 1
	else
	selfSay('Make second mission first!', cid)
	end
elseif(msgcontains(msg, 'ham') and talkState[talkUser] == 1) then
if (getPlayerStorageValue(cid,102) > 0) then
selfSay('You finished this mission.', cid)
else
if(doPlayerRemoveItem(cid, 2671, 20) == TRUE) then
setPlayerStorageValue(cid,102,1)
doPlayerAddExperience(cid,1000)
setPlayerStorageValue(cid,2291,3)
selfSay('Thank you! You finished all missions. (you received 1000 points of experience)', cid)
else
selfSay('You must have more items', cid)
end
end
return true
end


end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

af men af it suxs
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

function addExp(cid, amount)
	doPlayerAddExp(cid, amount)
	doSendAnimatedText(getThingPos(cid), amount, 215)
end

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

	local v = getPlayerStorageValue(cid, 100)
	if msgcontains(msg, 'first mission') or (v >= 0 and msgcontains(msg, 'meat')) then
		if v < 0 then
			selfSay('Please bring me 10 {meat}.', cid)
			setPlayerStorageValue(cid, 100, 0)
		elseif v == 0 then
			if doPlayerRemoveItem(cid, 2666, 10) then
				setPlayerStorageValue(cid, 100, 1)
				addExp(cid, 1000)
				selfSay('Thank you! You can now start the {second mission}. <you received 1000 points of experience>', cid)
			else
				selfSay('You don\'t have enough meat.', cid)
			end
		elseif v >= 1 then
			selfSay('You finished this mission already.', cid)
		end
	elseif (v >= 1 and msgcontains(msg, 'second mission')) or (v >= 2 and msgcontains(msg, 'ham')) then
		if v < 2 then
			selfSay('Please bring me 10 {ham}.', cid)
			setPlayerStorageValue(cid, 100, 2)
		elseif v == 2 then
			if doPlayerRemoveItem(cid, 2671, 10) then
				setPlayerStorageValue(cid, 100, 3)
				addExp(cid, 1000)
				selfSay('Thank you! You can now start the {third mission}. <you received 1000 points of experience>', cid)
			else
				selfSay('You don\'t have enough ham.', cid)
			end
		elseif v >= 3 then
			selfSay('You finished this mission already.', cid)
		end
	elseif (v >= 3 and msgcontains(msg, 'third mission')) or (v >= 4 and msgcontains(msg, 'ham')) then
		if v < 4 then
			selfSay('Please bring me 20 {ham}.', cid)
			setPlayerStorageValue(cid, 100, 4)
		elseif v == 4 then
			if doPlayerRemoveItem(cid, 2671, 20) then
				setPlayerStorageValue(cid, 100, 5)
				addExp(cid, 1000)
				selfSay('Thank you! You finished all missions. <you received 1000 points of experience>', cid)
			else
				selfSay('You don\'t have enough ham.', cid)
			end
		elseif v >= 5 then
			selfSay('You finished this mission already.', cid)
		end
	elseif msgcontains(msg, 'quest') or msgcontains(msg, 'mission') then
		if v == -1 then
			selfSay('You can start the {first mission}.', cid)
		elseif v == 0 then
			selfSay('Your current mission is to give me 10 {meat}.', cid)
		elseif v == 1 then
			selfSay('You can start the {second mission}.', cid)
		elseif v == 2 then
			selfSay('Your current mission is to give me 10 {ham}.', cid)
		elseif v == 3 then
			selfSay('You can start the {third mission}.', cid)
		elseif v == 4 then
			selfSay('Your current mission is to give me 20 {ham}.', cid)
		elseif v == 5 then
			selfSay('You have finished all missions.', cid)
		end
	end
	return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Last edited:
When i say
Hi
First mission
Meat <---- nothing happend
Edit this plx :D.
I want
Me: Hi
Npc: Hi
Me: First mission
Npc: bring me 10 {meat}
Me: meat
Npc: Thank you, you can start next mission.
 
Last edited:
Back
Top