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

Lua NPC respond wrong

ond

Veteran OT User
Joined
Mar 24, 2008
Messages
2,782
Solutions
25
Reaction score
491
Location
Sweden
Can someone help me fix my script? The NPC responds wrong. I don't really get any errors but perhaps someone can see the error in the script.

LUA:
dofile(getDataDir() .. 'global/greeting.lua')
 
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
local Topic = 0
 
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)
	Topic = 0
	return true
end

npcHandler:setMessage(MESSAGE_GREET, "Greetings, young mortal.")
npcHandler:setMessage(MESSAGE_WALKAWAY, "You can never outrun death.")
npcHandler:setMessage(MESSAGE_FAREWELL, "May the dark powers be with you.")

npcHandler:setCallback(CALLBACK_GREET, greetCallback)
 
 
 
function creatureSayCallback(cid, type, msg)
	if npcHandler.focus ~= cid then
		return false
	end
 
	msg = msg:lower()

local v = getPlayerStorageValue(cid, 4788) -- Standard Value
	
if (msgcontains(msg, "quest")) then
	if v < 1 then
		selfSay("I can reward you greatly if you do a few tasks for me. Are you interested?")
		Topic = 1
	else
		selfSay(v == 4 and "You have already done this quest.")
		Topic = 0
	end
	
elseif Topic == 1 then
		if msgcontains(msg, "yes") then
			selfSay("Fine, I need you to go to the dwarfs nest and bring back my book. They keep it in their nest. Are you still listening?")
			Topic = 2
		else
			selfSay("Then leave. I have no time for people like you.")
			npcHandler:releaseFocus()
			Topic = 0
		end
	
elseif Topic == 2 then
		if msgcontains(msg, "yes") then
			selfSay("Very well then report back here when you have got my book.")
			setPlayerStorageValue(cid, 4788, 1) -- First mission's value
			Topic = 0
		else
			selfSay("Then leave. I have no time for people like you.")
			Topic = 0
		end
		
-- First mission --

elseif (msgcontains(msg, "book") or msgcontains(msg, "mission") or msgcontains("task")) then
	if getPlayerStorageValue(cid, 5062) == 1 then
		if getPlayerItemCount(cid, 1961) >= 1 then
			selfSay("You did it, you find my old book! This will be remembered. Are you ready for another assignment?")
			setPlayerStorageValue(cid, 4788, 2)
			Topic = 3 
		else
			selfSay(v < 3 and "You haven't finished the current mission." or "You forgot the book..." or "You didn't bring that book yourself...") -- THIS DOESN'T WORK
			Topic = 0
		end
	end
	
-- Second mission --
	
elseif Topic == 3 then
		if msgcontains(msg, "yes") then -- DON'T RESPOND WHEN SAYING YES.
			selfSay("Very well then, the second thing I want you to do is finding a guy named Sony. He lives on the top of the volcano on Goroma Island. Are you still listening?")
			Topic = 4
		else
			selfSay("Fine. Come back when you're ready.")
			Topic = 0
		end
		
elseif Topic == 4 then
	if msgcontains(msg, "yes") then
		selfSay("Good. Find him, talk to him about dark forces. When you've done that, report back to me.")
		setPlayerStorageValue(cid, 4788, 3)
		Topic = 0
	else
		selfSay("Fine. Come back when you're ready.")
		Topic = 0
	end
	
elseif v == 4 then
	if (msgcontains(msg, "mission") or msgcontains(msg, "dark") or msgcontains(msg, "forces")) then
		selfSay("Wait... Let's see... Ah yes, I can sense the dark forces within you! Here you go. A little gift for making you run so far.")
		doPlayerAddItem(cid, 2195, 1)
		Topic = 0
	else
		selfSay(v < 4 and "You haven't got the dark forces in you.")
		Topic = 0
	end
	
end
	return TRUE
end

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

This doesn't work.
LUA:
selfSay(v < 3 and "You haven't finished the current mission." or "You forgot the book..." or "You didn't bring that book yourself...")
LUA:
elseif Topic == 3 then
		if msgcontains(msg, "yes") then
 
Last edited:
LUA:
selfSay(v < 3 and "You haven't finished the current mission." or "You forgot the book..." or "You didn't bring that book yourself...")

what do you want it to do? say one of those 3 options? u gotta use math.random for that.

Do you want him to say that your storage is to low? don't really get why.. but you can't use < for what the npc should say.. and if you want the npc to say a constant like getPlayerStorageValue(cid, 1) you need to write it like :
LUA:
selfSay(getPlayerStorageValue(cid,test) .. " is your storage for test.")
 
I'm noob at this, could you come with alternative ways to write it? Which you self would recomend
 
Try this and REP ++ please

LUA:
dofile(getDataDir() .. 'global/greeting.lua')
 
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
local Topic = 0
 
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)
	Topic = 0
	return true
end
 
npcHandler:setMessage(MESSAGE_GREET, "Greetings, young mortal.")
npcHandler:setMessage(MESSAGE_WALKAWAY, "You can never outrun death.")
npcHandler:setMessage(MESSAGE_FAREWELL, "May the dark powers be with you.")
 
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
 
 
 
function creatureSayCallback(cid, type, msg)
	if npcHandler.focus ~= cid then
		return false
	end
 
	msg = msg:lower()
 
local v = getPlayerStorageValue(cid, 4788) -- Standard Value
 
if (msgcontains(msg, "quest")) then
	if v < 1 then
		selfSay("I can reward you greatly if you do a few tasks for me. Are you interested?")
		Topic = 1
	else
		selfSay(v == 4 and "You have already done this quest.")
		Topic = 0
	end

elseif msgcontains(msg, "yes") and Topic > 0 then

 
		if Topic == 1 then
			selfSay("Fine, I need you to go to the dwarfs nest and bring back my book. They keep it in their nest. Are you still listening?")
			Topic = 2
 
		elseif Topic == 2 then
			selfSay("Very well then report back here when you have got my book.")
			setPlayerStorageValue(cid, 4788, 1) -- First mission's value
			Topic = 0

		elseif Topic == 3 then
			selfSay("Very well then, the second thing I want you to do is finding a guy named Sony. He lives on the top of the volcano on Goroma Island. Are you still listening?")
			Topic = 4

		elseif Topic == 4 then
			selfSay("Good. Find him, talk to him about dark forces. When you've done that, report back to me.")
			setPlayerStorageValue(cid, 4788, 3)
			Topic = 0

		end


 
-- First mission --
 
elseif (msgcontains(msg, "book") or msgcontains(msg, "mission") or msgcontains("task")) then
	if getPlayerStorageValue(cid, 5062) == 1 then
		if getPlayerItemCount(cid, 1961) >= 1 then
			selfSay("You did it, you find my old book! This will be remembered. Are you ready for another assignment?")
			setPlayerStorageValue(cid, 4788, 2)
			Topic = 3 
		else
			selfSay(v < 3 and "You haven't finished the current mission." or "You forgot the book..." or "You didn't bring that book yourself...") -- THIS DOESN'T WORK
			Topic = 0
		end
	end


elseif not (msgcontains(msg, "yes")) then

			if Topic == 1 or Topic == 2 then
				selfSay("Then leave. I have no time for people like you.")
				npcHandler:releaseFocus()
				Topic = 0

			elseif Topic == 3 or Topic == 4 then
				selfSay("Fine. Come back when you're ready.")
				Topic = 0
			end 
		end
-- Second mission --
 

	
	if v == 4 then
		if (msgcontains(msg, "mission") or msgcontains(msg, "dark") or msgcontains(msg, "forces")) then
		selfSay("Wait... Let's see... Ah yes, I can sense the dark forces within you! Here you go. A little gift for making you run so far.")
		doPlayerAddItem(cid, 2195, 1)
		Topic = 0
	else
		selfSay(v < 4 and "You haven't got the dark forces in you.")
		Topic = 0
	end

end
	return TRUE
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
PLEASE REP++

I fixed a minor bug
replace this new

and rep++

LUA:
dofile(getDataDir() .. 'global/greeting.lua')
 
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
local Topic = 0
 
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)
	Topic = 0
	return true
end
 
npcHandler:setMessage(MESSAGE_GREET, "Greetings, young mortal.")
npcHandler:setMessage(MESSAGE_WALKAWAY, "You can never outrun death.")
npcHandler:setMessage(MESSAGE_FAREWELL, "May the dark powers be with you.")
 
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
 
 
 
function creatureSayCallback(cid, type, msg)
	if npcHandler.focus ~= cid then
		return false
	end
 
	msg = msg:lower()
 
local v = getPlayerStorageValue(cid, 4788) -- Standard Value
 
if (msgcontains(msg, "quest")) then
	if v < 1 then
		selfSay("I can reward you greatly if you do a few tasks for me. Are you interested?")
		Topic = 1
	else
		selfSay(v == 4 and "You have already done this quest.")
		Topic = 0
	end

elseif msgcontains(msg, "yes") and Topic > 0 then

 
		if Topic == 1 then
			selfSay("Fine, I need you to go to the dwarfs nest and bring back my book. They keep it in their nest. Are you still listening?")
			Topic = 2
 
		elseif Topic == 2 then
			selfSay("Very well then report back here when you have got my book.")
			setPlayerStorageValue(cid, 4788, 1) -- First mission's value
			Topic = 0

		elseif Topic == 3 then
			selfSay("Very well then, the second thing I want you to do is finding a guy named Sony. He lives on the top of the volcano on Goroma Island. Are you still listening?")
			Topic = 4

		elseif Topic == 4 then
			selfSay("Good. Find him, talk to him about dark forces. When you've done that, report back to me.")
			setPlayerStorageValue(cid, 4788, 3)
			Topic = 0

		end


 
-- First mission --
 
elseif (msgcontains(msg, "book") or msgcontains(msg, "mission") or msgcontains("task")) then
	if getPlayerStorageValue(cid, 5062) == 1 then
		if getPlayerItemCount(cid, 1961) >= 1 then
			selfSay("You did it, you find my old book! This will be remembered. Are you ready for another assignment?")
			setPlayerStorageValue(cid, 4788, 2)
			Topic = 3 
		else
			selfSay(v < 3 and "You haven't finished the current mission." or "You forgot the book..." or "You didn't bring that book yourself...") -- THIS DOESN'T WORK
			Topic = 0
		end
	end


elseif not (msgcontains(msg, "yes")) then

-- Second mission --
	if v == 4 then
		if (msgcontains(msg, "mission") or msgcontains(msg, "dark") or msgcontains(msg, "forces")) then
		selfSay("Wait... Let's see... Ah yes, I can sense the dark forces within you! Here you go. A little gift for making you run so far.")
		doPlayerAddItem(cid, 2195, 1)
		Topic = 0
	else
		selfSay(v < 4 and "You haven't got the dark forces in you.")
		Topic = 0
	end

end
			if Topic == 1 or Topic == 2 then
				selfSay("Then leave. I have no time for people like you.")
				npcHandler:releaseFocus()
				Topic = 0

			elseif Topic == 3 or Topic == 4 then
				selfSay("Fine. Come back when you're ready.")
				Topic = 0
			end 
		end

	

	return TRUE
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Didn't quite work.

Code:
data/npc/scripts/lib/npc.lua:32: bad argument #2 to 'find' (string expected, got
 nil)
stack traceback:
        [C]: in function 'find'
        data/npc/scripts/lib/npc.lua:32: in function 'msgcontains'
        data/npc/scripts/noel.lua:72: in function 'callback'
        data/npc/scripts/lib/npcsystem/npchandler.lua:299: in function 'onCreatu
reSay'
        data/npc/scripts/noel.lua:11: in function <data/npc/scripts/noel.lua:11>

Also, is it possible to implent, after every time he says "Are you still listening." or "Are you still interested?" if you say any text at all he will say, "Fine, come back when you're ready."?
 
LUA:
dofile(getDataDir() .. 'global/greeting.lua')
 
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
local Topic = 0
 
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)
	Topic = 0
	return true
end
 
npcHandler:setMessage(MESSAGE_GREET, "Greetings, young mortal.")
npcHandler:setMessage(MESSAGE_WALKAWAY, "You can never outrun death.")
npcHandler:setMessage(MESSAGE_FAREWELL, "May the dark powers be with you.")
 
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
 
 
 
function creatureSayCallback(cid, type, msg)
	if npcHandler.focus ~= cid then
		return false
	end
 
	msg = msg:lower()
 
local v = getPlayerStorageValue(cid, 4788) -- Standard Value
 
if (msgcontains(msg, "quest")) then
	if v < 1 then
		selfSay("I can reward you greatly if you do a few tasks for me. Are you interested?")
		Topic = 1
	else
		selfSay(v == 4 and "You have already done this quest.")
		Topic = 0
	end
 
elseif msgcontains(msg, "yes") and Topic > 0 then
 
 
		if Topic == 1 then
			selfSay("Fine, I need you to go to the dwarfs nest and bring back my book. They keep it in their nest. Are you still listening?")
			Topic = 2
 
		elseif Topic == 2 then
			selfSay("Very well then report back here when you have got my book.")
			setPlayerStorageValue(cid, 4788, 1) -- First mission's value
			Topic = 0
 
		elseif Topic == 3 then
			selfSay("Very well then, the second thing I want you to do is finding a guy named Sony. He lives on the top of the volcano on Goroma Island. Are you still listening?")
			Topic = 4
 
		elseif Topic == 4 then
			selfSay("Good. Find him, talk to him about dark forces. When you've done that, report back to me.")
			setPlayerStorageValue(cid, 4788, 3)
			Topic = 0
 
		end
 
 
 
-- First mission --
 
elseif (msgcontains(msg, "book") or msgcontains(msg, "mission") or msgcontains(msg, "task")) then
	if getPlayerStorageValue(cid, 5062) == 1 then
		if getPlayerItemCount(cid, 1961) >= 1 then
			selfSay("You did it, you find my old book! This will be remembered. Are you ready for another assignment?")
			setPlayerStorageValue(cid, 4788, 2)
			Topic = 3 
		else
			selfSay(v < 3 and "You haven't finished the current mission." or "You forgot the book..." or "You didn't bring that book yourself...") -- THIS DOESN'T WORK
			Topic = 0
		end
	end
 
 
elseif not (msgcontains(msg, "yes")) then
 
-- Second mission --
	if v == 4 then
		if (msgcontains(msg, "mission") or msgcontains(msg, "dark") or msgcontains(msg, "forces")) then
		selfSay("Wait... Let's see... Ah yes, I can sense the dark forces within you! Here you go. A little gift for making you run so far.")
		doPlayerAddItem(cid, 2195, 1)
		Topic = 0
	else
		selfSay(v < 4 and "You haven't got the dark forces in you.")
		Topic = 0
	end
 
end
			if Topic == 1 or Topic == 2 then
				selfSay("Then leave. I have no time for people like you.")
				npcHandler:releaseFocus()
				Topic = 0
 
			elseif Topic == 3 or Topic == 4 then
				selfSay("Fine. Come back when you're ready.")
				Topic = 0
			end 
		end
 
 
 
	return TRUE
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())


I dont understood what you want try to explain better
REP++ for the help please
 
I will REP you for life if you can fix ONE more thing. The script is working but can you make it so:

When you haven't got storageValue(cid, 5062) or book, he says: You haven't finished the current mission.
And
When you haven't got storageValue(cid, 5062) BUT you have the book, he says: You can't bring someone elses book.
And
When you have the storageValue(cid, 5062) BUT you DON'T have the book, he says: You forgot to bring the book.
And
During first mission, when it's not done, if you say: book, mission or task, he should say: You haven't finished the current mission.

? That would make the script complete.
 
LUA:
dofile(getDataDir() .. 'global/greeting.lua')
 
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
local Topic = 0
 
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)
	Topic = 0
	return true
end
 
npcHandler:setMessage(MESSAGE_GREET, "Greetings, young mortal.")
npcHandler:setMessage(MESSAGE_WALKAWAY, "You can never outrun death.")
npcHandler:setMessage(MESSAGE_FAREWELL, "May the dark powers be with you.")
 
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
 
 
 
function creatureSayCallback(cid, type, msg)
	if npcHandler.focus ~= cid then
		return false
	end
 
	msg = msg:lower()
 
local v = getPlayerStorageValue(cid, 4788) -- Standard Value
 
if (msgcontains(msg, "quest")) then
	if v < 1 then
		selfSay("I can reward you greatly if you do a few tasks for me. Are you interested?")
		Topic = 1
	else
		selfSay(v == 4 and "You have already done this quest.")
		Topic = 0
	end
 
elseif msgcontains(msg, "yes") and Topic > 0 then
 
 
		if Topic == 1 then
			selfSay("Fine, I need you to go to the dwarfs nest and bring back my book. They keep it in their nest. Are you still listening?")
			Topic = 2
 
		elseif Topic == 2 then
			selfSay("Very well then report back here when you have got my book.")
			setPlayerStorageValue(cid, 4788, 1) -- First mission's value
			Topic = 0
 
		elseif Topic == 3 then
			selfSay("Very well then, the second thing I want you to do is finding a guy named Sony. He lives on the top of the volcano on Goroma Island. Are you still listening?")
			Topic = 4
 
		elseif Topic == 4 then
			selfSay("Good. Find him, talk to him about dark forces. When you've done that, report back to me.")
			setPlayerStorageValue(cid, 4788, 3)
			Topic = 0
 
		end
 
 
 
-- First mission --
 
elseif (msgcontains(msg, "book") or msgcontains(msg, "mission") or msgcontains(msg, "task")) then
	if getPlayerStorageValue(cid, 5062) == 1 and getPlayerItemCount(cid, 1961) >= 1 then
			selfSay("You did it, you found my old book! This will be remembered. Are you ready for another assignment?")
			setPlayerStorageValue(cid, 4788, 2)
			Topic = 3 
	elseif getPlayerItemCount(cid, 1961) >= 1 then
			selfSay("You can't bring someone elses book.")
			Topic = 0 
	elseif getPlayerStorageValue(cid, 5062) == 1 then
			selfSay("You forgot to bring the book.")
			Topic = 0 
	else
		selfSay("You haven't finished the current mission.")
		Topic = 0
	end
 
 
elseif not (msgcontains(msg, "yes")) then
 
-- Second mission --
	if v == 4 then
		if (msgcontains(msg, "mission") or msgcontains(msg, "dark") or msgcontains(msg, "forces")) then
		selfSay("Wait... Let's see... Ah yes, I can sense the dark forces within you! Here you go. A little gift for making you run so far.")
		doPlayerAddItem(cid, 2195, 1)
		Topic = 0
	else
		selfSay(v < 4 and "You haven't got the dark forces in you.")
		Topic = 0
	end
 
end
			if Topic == 1 or Topic == 2 then
				selfSay("Then leave. I have no time for people like you.")
				npcHandler:releaseFocus()
				Topic = 0
 
			elseif Topic == 3 or Topic == 4 then
				selfSay("Fine. Come back when you're ready.")
				Topic = 0
			end 
		end
 
 
 
	return TRUE
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
there ya go but the script doesn't remove the book.. if you want it to remove the book just add this:
LUA:
doPlayerRemoveItem(cid, 1961, 1)
 
Thanks alot! There is just ONE little thing left... when you are in the 2nd mission, if you say "mission" he says: You forgot to bring the book, even though you already finished that mission.
 
LUA:
dofile(getDataDir() .. 'global/greeting.lua')
 
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
local Topic = 0
 
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)
	Topic = 0
	return true
end
 
npcHandler:setMessage(MESSAGE_GREET, "Greetings, young mortal.")
npcHandler:setMessage(MESSAGE_WALKAWAY, "You can never outrun death.")
npcHandler:setMessage(MESSAGE_FAREWELL, "May the dark powers be with you.")
 
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
 
 
 
function creatureSayCallback(cid, type, msg)
	if npcHandler.focus ~= cid then
		return false
	end
 
	msg = msg:lower()
 
local v = getPlayerStorageValue(cid, 4788) -- Standard Value
 
if (msgcontains(msg, "quest")) then
	if v < 1 then
		selfSay("I can reward you greatly if you do a few tasks for me. Are you interested?")
		Topic = 1
	else
		selfSay(v == 4 and "You have already done this quest.")
		Topic = 0
	end
 
elseif msgcontains(msg, "yes") and Topic > 0 then
 
 
		if Topic == 1 then
			selfSay("Fine, I need you to go to the dwarfs nest and bring back my book. They keep it in their nest. Are you still listening?")
			Topic = 2
 
		elseif Topic == 2 then
			selfSay("Very well then report back here when you have got my book.")
			setPlayerStorageValue(cid, 4788, 1) -- First mission's value
			Topic = 0
 
		elseif Topic == 3 then
			selfSay("Very well then, the second thing I want you to do is finding a guy named Sony. He lives on the top of the volcano on Goroma Island. Are you still listening?")
			Topic = 4
 
		elseif Topic == 4 then
			selfSay("Good. Find him, talk to him about dark forces. When you've done that, report back to me.")
			setPlayerStorageValue(cid, 4788, 3)
			Topic = 0
 
		end
 
 
 
-- First mission --
 
elseif (msgcontains(msg, "book") or msgcontains(msg, "mission") or msgcontains(msg, "task")) and getPlayerStorageValue(cid, 5062) < 2 then
	if getPlayerStorageValue(cid, 5062) == 1 and getPlayerItemCount(cid, 1961) >= 1 then
			selfSay("You did it, you found my old book! This will be remembered. Are you ready for another assignment?")
			setPlayerStorageValue(cid, 4788, 2)
			Topic = 3 
	elseif getPlayerItemCount(cid, 1961) >= 1 then
			selfSay("You can't bring someone elses book.")
			Topic = 0 
	elseif getPlayerStorageValue(cid, 5062) == 1 then
			selfSay("You forgot to bring the book.")
			Topic = 0 
	else
		selfSay("You haven't finished the current mission.")
		Topic = 0
	end
 
 
elseif not (msgcontains(msg, "yes")) then
 
-- Second mission --
	if v == 4 then
		if (msgcontains(msg, "mission") or msgcontains(msg, "dark") or msgcontains(msg, "forces")) then
		selfSay("Wait... Let's see... Ah yes, I can sense the dark forces within you! Here you go. A little gift for making you run so far.")
		doPlayerAddItem(cid, 2195, 1)
		Topic = 0
	else
		selfSay(v < 4 and "You haven't got the dark forces in you.")
		Topic = 0
	end
 
end
			if Topic == 1 or Topic == 2 then
				selfSay("Then leave. I have no time for people like you.")
				npcHandler:releaseFocus()
				Topic = 0
 
			elseif Topic == 3 or Topic == 4 then
				selfSay("Fine. Come back when you're ready.")
				Topic = 0
			end 
		end
 
 
 
	return TRUE
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

there ya go
 
Back
Top