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

Adding a skill requirement to quest npc

kessykins

Intermediate OT User
Joined
Mar 15, 2010
Messages
297
Reaction score
105
What should I change in order to make the npc require fishing 65 in order to start her quest? This is what she'll say but.. I don't know where to put it x.x
"Sorry but your fishing skill needs to be atleast 65 to become an intermediate fisherman. Come back when you are more experienced."

This is the current npc lua:

Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
local Topic = {}
local storage = 30001
local exp1 = 10000
local exp2 = 20000
local pos = getPlayerPosition(cid)
 
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
	elseif msgcontains(msg, 'quest') or msgcontains(msg, 'intermediate') or msgcontains(msg, 'mission') then
		local v = getPlayerStorageValue(cid, storage)
		if v == -1 then
			npcHandler:say("So you are already an apprentice fisherman but you wish to become an intermediate fisherman? You need to prove to me that you are worthy of my help. Bring me 1 Morgaroth Heart, 10 Vampire Dust, 10 Ape Fur and 10 Blue Pieces of Cloth. Come back to me and say {mission}.", cid)
			setPlayerStorageValue(cid, storage, 1)
		elseif v == 1 then
			npcHandler:say("Did you bring me 1 Morgaroth Heart, 10 Vampire Dust, 10 Ape Fur and 10 Blue Pieces of Cloth?", cid)
			Topic[cid] = 1
		elseif v == 2 then
			npcHandler:say("So! You now have your pole. The next step is to prove to me that you can fish. Bring me 10 Common Frozen Objects, 5 Uncommon Frozen Objects and 1 Rare Frozen Object. Come back to me and say {mission}.", cid)
			setPlayerStorageValue(cid, storage, 3)	
		elseif v == 3 then
			npcHandler:say("Did you bring me 10 Common Frozen Objects, 5 Uncommon Frozen Objects and 1 Rare Frozen Object?", cid)
			Topic[cid] = 2
		elseif v == 4 then
			npcHandler:say("You have completed all my missions. Speak with Julian to become an Expert Fisherman!", cid)
		end
	elseif msgcontains(msg, 'yes') and Topic[cid] == 1 then
		if getPlayerItemCount(cid, 5943) >= 1 and getPlayerItemCount(cid, 5905) >= 10 and getPlayerItemCount(cid, 5912) >= 10 and getPlayerItemCount(cid, 5883) >= 10 then
			doPlayerRemoveItem(cid, 5943, 1)
			doPlayerRemoveItem(cid, 5905, 10)
			doPlayerRemoveItem(cid, 5912, 10)
			doPlayerRemoveItem(cid, 5883, 10)
			npcHandler:say("Splendid! Go grab your new Ice Fishing Pole from my garden. When you are ready speak to me about your next {mission}.", cid)
			doPlayerAddExp(cid, exp1)
			doPlayerSendTextMessage(cid,22,"You have gained 10000 experience.")
	        doSendMagicEffect(pos, CONST_ME_REDSHIMMER)
			setPlayerStorageValue(cid, storage, 2)
			Topic[cid] = 1
		else
			npcHandler:say("Sorry, you don\'t have everything I asked for.", cid)
			Topic[cid] = 0
		end
	elseif msgcontains(msg, 'yes') and Topic[cid] == 2 then
		if getPlayerItemCount(cid, 10581) >= 10 and getPlayerItemCount(cid, 10582) >= 5 and getPlayerItemCount(cid, 10577) >= 1 then
			doPlayerRemoveItem(cid, 10581, 10)
			doPlayerRemoveItem(cid, 10582, 5)
			doPlayerRemoveItem(cid, 10577, 1)
			npcHandler:say("Well done! You are now officially an Intermediate Fisherman! Go talk to Julian for your next task.", cid)
			doPlayerAddExp(cid, exp2)
			doPlayerSendTextMessage(cid,22,"You have gained 20000 experience.")
	        doSendMagicEffect(pos, CONST_ME_REDSHIMMER)
			setPlayerStorageValue(cid, storage, 4)
			setPlayerStorageValue(cid, 30002, 4)
			Topic[cid] = 0
		else
			npcHandler:say("Sorry, you don\'t have everything I asked for.", cid)
			Topic[cid] = 0
		end
	elseif msgcontains(msg, 'no') and Topic[cid] > 0 then
		npcHandler:say("Okay then.", cid)
		Topic[cid] = 0
	end
	return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Try this, I think it should work!
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
local Topic = {}
local storage = 30001
local exp1 = 10000
local exp2 = 20000
local pos = getPlayerPosition(cid)
 
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
	elseif msgcontains(msg, 'quest') or msgcontains(msg, 'intermediate') or msgcontains(msg, 'mission') then
		[COLOR="red"]if getPlayerSkillLevel(cid, 6) >= 65 then[/COLOR]	
			local v = getPlayerStorageValue(cid, storage)
			if v == -1 then
				npcHandler:say("So you are already an apprentice fisherman but you wish to become an intermediate fisherman? You need to prove to me that you are worthy of my help. Bring me 1 Morgaroth Heart, 10 Vampire Dust, 10 Ape Fur and 10 Blue Pieces of Cloth. Come back to me and say {mission}.", cid)
				setPlayerStorageValue(cid, storage, 1)
			elseif v == 1 then
				npcHandler:say("Did you bring me 1 Morgaroth Heart, 10 Vampire Dust, 10 Ape Fur and 10 Blue Pieces of Cloth?", cid)
				Topic[cid] = 1
			elseif v == 2 then
				npcHandler:say("So! You now have your pole. The next step is to prove to me that you can fish. Bring me 10 Common Frozen Objects, 5 Uncommon Frozen Objects and 1 Rare Frozen Object. Come back to me and say {mission}.", cid)
				setPlayerStorageValue(cid, storage, 3)	
			elseif v == 3 then
				npcHandler:say("Did you bring me 10 Common Frozen Objects, 5 Uncommon Frozen Objects and 1 Rare Frozen Object?", cid)
				Topic[cid] = 2
			elseif v == 4 then
				npcHandler:say("You have completed all my missions. Speak with Julian to become an Expert Fisherman!", cid)
			end
		[COLOR="red"]else
			npcHandler:say("Come back when you're more of a skilled fishermen!")
			Topic[cid] = 0
		end[/COLOR]	
	elseif msgcontains(msg, 'yes') and Topic[cid] == 1 then
		if getPlayerItemCount(cid, 5943) >= 1 and getPlayerItemCount(cid, 5905) >= 10 and getPlayerItemCount(cid, 5912) >= 10 and getPlayerItemCount(cid, 5883) >= 10 then
			doPlayerRemoveItem(cid, 5943, 1)
			doPlayerRemoveItem(cid, 5905, 10)
			doPlayerRemoveItem(cid, 5912, 10)
			doPlayerRemoveItem(cid, 5883, 10)
			npcHandler:say("Splendid! Go grab your new Ice Fishing Pole from my garden. When you are ready speak to me about your next {mission}.", cid)
			doPlayerAddExp(cid, exp1)
			doPlayerSendTextMessage(cid,22,"You have gained 10000 experience.")
	        doSendMagicEffect(pos, CONST_ME_REDSHIMMER)
			setPlayerStorageValue(cid, storage, 2)
			Topic[cid] = 1
		else
			npcHandler:say("Sorry, you don\'t have everything I asked for.", cid)
			Topic[cid] = 0
		end
	elseif msgcontains(msg, 'yes') and Topic[cid] == 2 then
		if getPlayerItemCount(cid, 10581) >= 10 and getPlayerItemCount(cid, 10582) >= 5 and getPlayerItemCount(cid, 10577) >= 1 then
			doPlayerRemoveItem(cid, 10581, 10)
			doPlayerRemoveItem(cid, 10582, 5)
			doPlayerRemoveItem(cid, 10577, 1)
			npcHandler:say("Well done! You are now officially an Intermediate Fisherman! Go talk to Julian for your next task.", cid)
			doPlayerAddExp(cid, exp2)
			doPlayerSendTextMessage(cid,22,"You have gained 20000 experience.")
	        doSendMagicEffect(pos, CONST_ME_REDSHIMMER)
			setPlayerStorageValue(cid, storage, 4)
			setPlayerStorageValue(cid, 30002, 4)
			Topic[cid] = 0
		else
			npcHandler:say("Sorry, you don\'t have everything I asked for.", cid)
			Topic[cid] = 0
		end
	elseif msgcontains(msg, 'no') and Topic[cid] > 0 then
		npcHandler:say("Okay then.", cid)
		Topic[cid] = 0
	end
	return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
the parts in red where the ones that where added.
 
Tits or GTFO girls.

sry u only get kitty d;
sigpic93562_2.gif
 
Back
Top