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

Quest NPC = 15 items and storage TFS 0.3.5pl1

breadmaker

New Member
Joined
Jul 16, 2010
Messages
160
Reaction score
3
Hello.
I need a few quests npc.

TFS 0.3.5pl1

1)

ID`s:
5136 - Rat tail x15 (you need 15 rat tails)
5136 - Storage after complete quest!


Example:
Player: hi
NPC: Whoa ? Who are you, I think you are so strong. I have very terrible {problem}, can you help me with this {problem} ?
Player: problem
NPC: In my cellar, last night I see rats. Im very sick when I see rats. When i eat bread the rats annoying me ! Go find them and bring me 15x {Rat Tail`s}.
Player: Rat tail
If player doesnt have 15x rat tails then:
NPC: Are you kidding me ? I dont see any rat tails on your hand! You doesnt get them! Grrr... come back when you got fiveteen.
If player have 15x rat tails then:
NPC: Oh God! You are strong enough! Now you can go! Happy adventure, friend!
Player get storage = 5136
Player: Rat Tails
If player complete quest and he want replay:
NPC: You done this quest yet, im very happy about that!


2) Same as first NPC but you can replay the mission and get EXP and Money, 10 cc per 15 tails.

Rep++ if you do it :)
I waiting...
 
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

local Topic = {}
local storage = 5136

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 greetCallback(cid)
	local v = getPlayerStorageValue(cid, storage)
	if v < 1 then
		npcHandler:setMessage(MESSAGE_GREET, "Whoa, who are you? I think you are strong enough. I have a very terrible {problem}, can you {help} me?")
	elseif v == 1 then
		npcHandler:setMessage(MESSAGE_GREET, "So, did you bring me 15 {rat tails}?")
	elseif v == 2 then
		npcHandler:setMessage(MESSAGE_GREET, "You have already done my task, and I'm very happy about it!")
	end
	return true
end

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

	local v = getPlayerStorageValue(cid, storage)
	if msgcontains(msg, 'problem') or msgcontains(msg, 'help') or (v >= 1 and msgcontains(msg, 'rat tail')) then
		if v < 1 then
			npcHandler:say('I saw rats in my cellar last night. I get very sick when I see rats. When I\'m eating bread the rats are annoying me! Go find them and bring me back 15 {rat tails}.', cid)
			setPlayerStorageValue(cid, storage, 1)
		elseif v == 1 then
			if doPlayerRemoveItem(cid, 5136, 15) then
				npcHandler:say('Oh God! You are strong enough! Now you can go! Happy adventure, friend!', cid)
				setPlayerStorageValue(cid, storage, 2)
			else
				npcHandler:say('Are you kidding me ? I dont see any rat tails on your hand! You didn\'t get them! Grrr... come back when you\'ve got fifteen.', cid)
			end
		elseif v == 2 then
			npcHandler:say('You have already done my task, and I\'m very happy about it!', cid)
		end
	end
	return true
end

npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

local Topic = {}
local storage = 5136

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 greetCallback(cid)
	local v = getPlayerStorageValue(cid, storage)
	if v < 1 then
		npcHandler:setMessage(MESSAGE_GREET, "Whoa, who are you? I think you are strong enough. I have a very terrible {problem}, can you {help} me?")
	elseif v == 1 then
		npcHandler:setMessage(MESSAGE_GREET, "So, did you bring me 15 {rat tails}?")
	elseif v == 2 then
		npcHandler:setMessage(MESSAGE_GREET, "You have already done my task, and I'm very happy about it!")
	end
	return true
end

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

	local v = getPlayerStorageValue(cid, storage)
	if msgcontains(msg, 'problem') or msgcontains(msg, 'help') or (v >= 1 and msgcontains(msg, 'rat tail')) then
		if v < 1 then
			npcHandler:say('I saw rats in my cellar last night. I get very sick when I see rats. When I\'m eating bread the rats are annoying me! Go find them and bring me back 15 {rat tails}.', cid)
			setPlayerStorageValue(cid, storage, 1)
		elseif v == 1 then
			if doPlayerRemoveItem(cid, 5136, 15) then
                                doPlayerAddItem(cid, 2160,10)
				npcHandler:say('Oh God! You are strong enough! Now you can go! Happy adventure, friend!', cid)
				setPlayerStorageValue(cid, storage, 2)
			else
				npcHandler:say('Are you kidding me ? I dont see any rat tails on your hand! You didn\'t get them! Grrr... come back when you\'ve got fifteen.', cid)
			end
		elseif v == 2 then
			npcHandler:say('You have already done my task, and I\'m very happy about it!', cid)
		end
	end
	return true
end

npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Add rep++ for me if i helped you please and i will give back :ninja:
 
Back
Top