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

Help me -- npc

alissonfgp

LUA, C, C++, C#
Joined
Jul 13, 2011
Messages
111
Reaction score
29
Location
Brazil
I need help here ...
The NPC did not respond according to what I have asked for storage but he responds, I do the mission and then he keeps on saying the same thing as before, someone could see if there is any error that is messing up?

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, "job")) then
			setPlayerStorageValue(cid, STORAGE_PALIMUTH, 1)
			npcHandler:say("I\'m an Augur of the city of Yalahar. My special duty consists of coordinating the efforts to keep the city and its services running.", cid)
	elseif(msgcontains(msg, "mission")) then
		elseif(getPlayerStorageValue(cid, STORAGE_PALIMUTH) == 1) then
			npcHandler:say("You probably heard that we have numerous problems in different quarters of our city. Our forces are limited, so we really could need some help from outsiders. ... ", cid)
			npcHandler:say("Would you like to assist us in re-establishing order in our city? ", cid)
			setPlayerStorageValue(cid, STORAGE_PALIMUTH, 2)

	elseif(getPlayerStorageValue(cid, STORAGE_PALIMUTH) == 2) then
			npcHandler:say("I\'m pleased to hear that. Rarely we meet outsiders that care about our problems. Most people come here looking for wealth and luxury. ...", cid)
			npcHandler:say("However, I have to tell you that our ranking system is quite rigid. So, I'm not allowed to entrust you with important missions as long as you haven't proven yourself as reliable. ... ", cid)
			npcHandler:say("If you are willing to work for the city of Yalahar, you can ask me for a mission any time, be it night or day.", cid)
			setPlayerStorageValue(cid, STORAGE_PALIMUTH, 3)

	elseif(getPlayerStorageValue(cid, STORAGE_CROWBAR) == 5) then
			npcHandler:say("I hope your first mission will not scare you off. Even though, we cut off our sewer system from other parts of the city to prevent the worst, it still has deteriorated in the last decades. ...", cid)
			npcHandler:say("Certain parts of the controls are rusty and the drains are stuffed with garbage. Get yourself a crowbar, loosen the controls and clean the pipes from the garbage. ...", cid)
			npcHandler:say("We were able to locate the 4 worst spots in the sewers. I will mark them for you on your map so you have no trouble finding them. Report to me when you have finished your mission.", cid)
			setPlayerStorageValue(cid, STORAGE_PALIMUTH, 4)

	elseif(msgcontains(msg, "mission")) then
			elseif(getPlayerStorageValue(cid, STORAGE_PALIMUTH) == 4) then
			npcHandler:say("So are you done with your work?", cid)

	elseif(msgcontains(msg, "yes")) then
			npcHandler:say("Thank you very much. You have no idea how hard it was to find someone volunteering for that job. If you feel ready for further missions, just tell me.", cid)
			setPlayerStorageValue(cid, STORAGE_GUARD, 1)

	elseif(msgcontains(msg, "mission")) then
		elseif(getPlayerStorageValue(cid, STORAGE_GUARD) == 8) then
			npcHandler:say("We are still present at each quarter\'s city wall, even though we can do little to stop the chaos from spreading. Still, our garrisons are necessary to maintain some sort of order in the city. ...", cid)
			npcHandler:say("My superiors ask for a first hand report about the current situation in the single city quarters. I need someone to travel to our garrisons to get the reports from the guards. Are you willing to do that?", cid)

	elseif(msgcontains(msg, "yes")) then
			npcHandler:say("I must warn you, the quarters are in a horrible state. I strongly advise you to stay on the main roads whenever possible while you get those reports. ...", cid)
			npcHandler:say("You\'ll find our seven guards at the gates of each quarter. Just ask them for their report and they will tell you all you need to know.", cid)
			setPlayerStorageValue(cid, STORAGE_PALIMUTH, 5)

	elseif(msgcontains(msg, "mission")) then
		elseif(getPlayerStorageValue(cid, STORAGE_PALIMUTH) == 5) then
			npcHandler:say("I did my best to impress my superiors with your accomplishments and it seems that it worked quite well. They want you for their own missions now. ...", cid)
			npcHandler:say("Missions that are more important than the ones you've fulfilled for me. However, before you leave, there are still some things I need to tell you. ...", cid)
			npcHandler:say("Listen, I can\'t explain you everything in detail right now and here. You never know who might be eavesdropping. ...", cid)
			npcHandler:say("I left some notes in the small room there. Get them and read them. Talk to me again when you've read the notes.", cid)
			setPlayerStorageValue(cid, STORAGE_NOTES, 1)

	elseif(msgcontains(msg, "mission")) then
		elseif(getPlayerStorageValue(cid, STORAGE_NOTES) == 2) then
			npcHandler:say("Now you know as much as we do about the things happening in Yalahar. It\'s up to you what you do with this information. ...", cid)
			npcHandler:say("Now leave and talk to my superior Azerus in the city centre to get your next mission. I urge you, though, to talk to me whenever he sends you on a new mission. ...", cid)
			npcHandler:say("I think it is important that you hear my opinion about them. Now hurry. I suppose Azerus is already waiting.", cid)
			setPlayerStorageValue(cid, STORAGE_AZERUS, 1)

	elseif(msgcontains(msg, "mission")) then
		elseif(getPlayerStorageValue(cid, STORAGE_AZERUS) == 4) then
			npcHandler:say("This quarter has been sealed off years ago. To send someone there poses a high risk to spread the plague. I assume these research notes you've mentioned must be very important. ... ", cid)
			npcHandler:say("After all those years it is more than strange that someone shows interest in these notes now. Considering what has happened to the alchemists, it is rather unlikely that they contain harmless information. ... ", cid)
			npcHandler:say("I fear these notes will be used to turn the plague into some kind of weapon. Someone with this plague at his disposal could subdue the whole city by blackmailing. ...", cid)
			npcHandler:say("I beg you to destroy these notes. Just put them into some burning oven to get rid of them and report that you did not find the notes.", cid)
			setPlayerStorageValue(cid, STORAGE_AZERUS, 5)

	elseif(msgcontains(msg, "mission")) then
		elseif(getPlayerStorageValue(cid, STORAGE_AZERUS) == 6) then
			npcHandler:say("Mr. West is a little paranoid. That\'s the reason for his immense private army of bodyguards. He could surely be helpful, especially as he rules over the former trade quarter. ...", cid)
			npcHandler:say("If you were able to reach him without killing his henchmen, you could probably convince him that you mean no harm to him. ...", cid)
			npcHandler:say("That would certainly cement our relationship without any needless bloodshed. Perhaps you could use the way through the sewers to avoid his men. ...", cid)
			npcHandler:say("Mr. West is not a bad man. We should be able to work out some plans to reconstruct the city's safety as soon as he overcomes his paranoia towards us.", cid)
			setPlayerStorageValue(cid, STORAGE_AZERUS, 7)

	elseif(msgcontains(msg, "mission")) then
		elseif(getPlayerStorageValue(cid, STORAGE_AZERUS) == 10) then
			npcHandler:say("Warbeasts? Is this true? People are already starving. ...", cid)
			npcHandler:say("How can we afford to feed an army of hungry beasts? They will not only strengthen the power of the Yalahari over the citizens, they also mean starvation and deathfor the poor. ...", cid)
			npcHandler:say("Instead of breeding warbeasts, this druid should breed cattle to feed our people. Please I beg you, convince him to do that!", cid)
			setPlayerStorageValue(cid, STORAGE_AZERUS, 11)

	elseif(msgcontains(msg, "mission")) then
		elseif(getPlayerStorageValue(cid, STORAGE_GOOD) == 1) then
			npcHandler:say("These are great news indeed. The people of Yalahar will be grateful. The Yalahari probably not, so take care of yourself.", cid)
			setPlayerStorageValue(cid, STORAGE_GOOD, 2)

	elseif(msgcontains(msg, "mission")) then
		elseif(getPlayerStorageValue(cid, STORAGE_GOOD) == 2) then
			npcHandler:say("This druid dares to affront us? We will look into this when we have enough time. But there are other things that needs to be settled. ...", cid)
			npcHandler:say("Although, we probably should not do so after your last failure, we are willing to grant you another mission.", cid)
			setPlayerStorageValue(cid, STORAGE_AZERUS, 14)

	elseif(msgcontains(msg, "mission")) then
		elseif(getPlayerStorageValue(cid, STORAGE_AZERUS) == 15) then
			npcHandler:say("What a sick idea to misuse tortured souls to power some device! Though, this charm might be useful to free these poor souls. ...", cid)
			npcHandler:say("Please capture the souls as you have been instructed and then bring the charm to me. I will see to it that the souls are freed to go to the afterlife in peace. ...", cid)
			setPlayerStorageValue(cid, STORAGE_AZERUS, 16)

	elseif(msgcontains(msg, "mission")) then
		elseif(getPlayerStorageValue(cid, STORAGE_AZERUS) == 17) then
			npcHandler:say("I thank you also in the name of these poor lost souls. I will send the charm to a priest who is able to release them. ...", cid)
			npcHandler:say("Tell the Yalahari that the charm was destroyed by the energy it contained.", cid)
			doPlayerRemoveItem(cid,9742,1)
			setPlayerStorageValue(cid, STORAGE_GOOD, 3)
			setPlayerStorageValue(cid, STORAGE_AZERUS, 18)

	elseif(msgcontains(msg, "mission")) then
		elseif(getPlayerStorageValue(cid, STORAGE_AZERUS) == 19) then
			npcHandler:say("The quara are indeed a threat. Yet, they are numerous and reproduce quickly. Slaying some of them will only enrage them even more. ...", cid)
			npcHandler:say("The quara have been there for many generations. They have never threatened anyone who stayed out of their watery realm. ...", cid)
			npcHandler:say("It would be much more useful to find out what the quara are so upset about. Better avoid slaying their leaders as this will only further the animosities.", cid)
			setPlayerStorageValue(cid, STORAGE_AZERUS, 19)

	elseif(msgcontains(msg, "mission")) then
		elseif(getPlayerStorageValue(cid, STORAGE_AZERUS) == 22) then
			npcHandler:say("The constant unrest in the city is to a great extent caused by the lack of food. Weapons will only serve to suppress the poor. ...", cid)
			npcHandler:say("The factory you were sent to was once used for the production of food. Somewhere in the factory you might find an old pattern crystal for the production of food. ...", cid)
			npcHandler:say("If you use it on the controls instead of the weapon pattern, you will ensure that our people are supplied with the desperately needed food.", cid)
			setPlayerStorageValue(cid, STORAGE_AZERUS, 23)
	end
	return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Last edited:
Can you explain what it should do?
Btw you don't have to repeat the same message (elseif(msgcontains(msg, "mission")) etc), you can just check for it 1x and then check for storage.

Next time post it in Support, this is for requests.
 
Last edited:
Can you explain what it should do?
Btw you don't have to repeat the same message (elseif(msgcontains(msg, "mission")) etc), you can just check for it 1x and then check for storage.

Next time post it in Support, this is for requests.

where is "elseif (msgcontains (msg," mission ")) then" is when the player picks up the mission and where is "elseif (msgcontains (msg," yes ")) then" is for when he accepts the mission and have to go to complete it, then it comes back and says to report mission.
I give REP + + for help.

- - - Updated - - -

ok, I do not know srry
 
I mean that you repeated this alot, same goes for the yes (2x), you only have to write this 1x, then for the rest check for storage.
 
yes, I tried but I got the storage of the next mission and he did not answer anything if I say mission, and not even an error appears in the log.

one base for example:
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, "mission")) then
		if(getPlayerStorageValue(cid, STORAGE_ONGULF) < 1) then
			selfSay("Well, it's a long story but you really should listen to understand what is going on here. You can also hear a short version of the story, but then don't blame me if you mess something up due to your undwarfish impatience. ... ", cid)
			selfSay("So what would you like to hear, the long story or the short version? ", cid, true)
			talkState[talkUser] = 1
		elseif(getPlayerStorageValue(cid, STORAGE_ONGULF) == 1) then
			selfSay("Listen, I can handle the organisation down here and my boys will handle the construction of the base fine enough. Actually, all you do down here is to stand in the workers' way. ... ", cid)
			selfSay("But there might be something for you to do outside the base. We need to learn more about the land up there. Take the lift and do some exploring. Find a passage leading out of the mountains. ... ", cid, true)
			selfSay("Do not explore any further though. You never know whom you might be messing with. ", cid, true)
			setPlayerStorageValue(cid, STORAGE_ONGULF, 2)
		elseif(getPlayerStorageValue(cid, STORAGE_ONGULF) == 3) then
			selfSay("Excellent. Although we have no idea what awaits us in this foreign land, it is always good to know something more about our surroundings. ", cid)
			setPlayerStorageValue(cid, STORAGE_ONGULF, 4)
		elseif(getPlayerStorageValue(cid, STORAGE_ONGULF) == 4) then
			selfSay("Things are running fine so far. Actually so fine that we are short of supplies and men. I'd send a letter home but I guess sending you to get some assistance gives the whole affair a bit more urgency. ... ", cid)
			selfSay("So please travel back to Kazordoon. In the western mines outside of The Big Old One, you'll find Melfar of the imperial mining guild. Ask him to send some more miners and wood. When you return, I might have some more interesting missions for you. ", cid, true)
			setPlayerStorageValue(cid, STORAGE_ONGULF, 5)
		elseif(getPlayerStorageValue(cid, STORAGE_ONGULF) == 8) then
			selfSay("Our guards reported some nightly visitors. They chased them through the mountains but lost them when the fugitives climbed up some vines. ... ", cid)
			selfSay("It could easily be some trap and I'm somewhat reluctant to send you there, but we can't allow some invisible aggressor to spy on us and maybe to prepare an attack. ... ", cid, true)
			selfSay("Find these vines in this mountain, climb up there and find out who is spying on us! If they mean harm, get rid of them if possible. ... ", cid, true)
			selfSay("If they are too powerful, just retreat and we will have to re-evaluate the situation. If they are harmless, all the better. ", cid, true)
			setPlayerStorageValue(cid, STORAGE_ONGULF, 9)
		elseif(getPlayerStorageValue(cid, STORAGE_ONGULF) == 10) then
			selfSay("Primitive humans you say? This are most startling news, that's for sure. Well, I guess I'll send some victuals we can spare as a sign of our good will. ... ", cid)
			selfSay("However, our miners encountered another problem in the meantime. I'm afraid this will be your next mission. ", cid, true)
			setPlayerStorageValue(cid, STORAGE_ONGULF, 11)
		elseif(getPlayerStorageValue(cid, STORAGE_ONGULF) == 11) then
			selfSay("It seems things went from bad to worse! First we had some problems with the mine shafts we were building, and now that we found some precious veins in one of the new mines, and it happens to be the holiday resort of some hostile stone creatures! ... ", cid)
			selfSay("Nothing we dwarfs couldn't handle alone, but I rather thought this could be something interesting for an adventurer like you. ... ", cid, true)
			selfSay("So I reserved you the privilege to slay the leader! Use the mining lift to reach mine A07. The more stone creatures you kill, the better. Your mission, however, is to slay their leader, most likely some special stone beast. ", cid, true)
			setPlayerStorageValue(cid, STORAGE_ONGULF, 12)
		elseif(getPlayerStorageValue(cid, STORAGE_ONGULF) == 13) then
			selfSay("Shortly after you killed that creature, the others crumbled to dust and stone. I hope this incident does not foreshadow similar problems in our mines. However, for now I have other things to take care of and you have other missions to accomplish.", cid)
			setPlayerStorageValue(cid, STORAGE_ONGULF, 14)
		elseif(getPlayerStorageValue(cid, STORAGE_ONGULF) == 14) then	
			selfSay("Things are getting more and more complicated. You need to convince our friends that some intervention for their part is needed. ... ", cid)
			selfSay("We've come a long way with our own resources, but now our resources are short and we need the others to step in. I want you to negotiate some more support from our partners. ... ", cid, true)
			selfSay("You'll need all your diplomacy and influence. If you blow the negotiations, look for a guy called Black Bert in Thais. ... ", cid, true)
			selfSay("He has access to all kind of odd items, and he might have just the right bribe to convince someone to continue negotiations. ... ", cid, true)
			selfSay("It will not be as easy as it might sound. So watch your words and your manners and keep in mind whom you are talking to. ... ", cid, true)
			selfSay("Different strategies might be necessary for different people. You may try to FLATTER, THREATEN, IMPRESS, BLUFF, PLEA or to REASON with them. You probably need some luck as well. ... ", cid, true)
			selfSay("And now listen: We need more workers for the mines. The technomancers told us that a guy named Telas, who lives in Edron, copied the worker golem technology from Yalahar. Convince him to send us some of these golems. ... ", cid, true)
			selfSay("Further, we have more ore and end products than we can use right now. So we need someone to buy all the surplus. Convince Leeland Slim in Venore that the local traders step in as resellers. ... ", cid, true)
			selfSay("Another issue at hand is our lack of drilling worms. That should not be a big problem though. Just talk to the worm tamer in Kazordoon. If he does not get mad about you, there should be no problem to get his support. ... ", cid, true)
			selfSay("Also, now that our monetary resources are used up and not much cash is coming in, we need additional help to finance this venture. Thais has promised money in advance, but we haven't seen any of this support, yet. ... ", cid, true)
			selfSay("Convince the Thaian king to send us the promised money right now. ... ", cid, true)
			selfSay("Another problem we need to solve is the exploration of our surroundings. We need to know friends and enemies, and find out about the plants and beasts in the vicinity and learn what is edible and what is dangerous. ... ", cid, true)
			selfSay("This is all stuff the Explorer Society is interested in. It should be easy to convince their representative in Port Hope. ... ", cid, true)
			selfSay("At last, with the growing numbers of adventurers here, not only the security of the base is growing but also the demand for certain supplies. I'd like the Edron academy to open up a shop in the base. We need to keep you adventurers happy, don't we? ... ", cid, true)
			selfSay("Well, I hope you understand the importance of this mission and got what it takes to fulfil it. So hurry up and get us the needed support. ", cid, true)
			setPlayerStorageValue(cid, STORAGE_ONGULF, 15)
		elseif(getPlayerStorageValue(cid, STORAGE_ONGULF) == 15) then
			if(getPlayerStorageValue(cid, STORAGE_ALLIES) == 6) then
				selfSay("You did an excellent job! With all this help Farmine will grow and prosper. While we put all available resources into building this base, I have another urgent mission for you. ", cid)
				setPlayerStorageValue(cid, STORAGE_ONGULF, 16)
			else
				selfSay("Are you done yet?", cid)
			end
		elseif(getPlayerStorageValue(cid, STORAGE_ONGULF) == 16) then
			selfSay("Our new friends, those primitive humans sent us a warning. According to them, the 'green men' of the plains plan an attack on the mountains. ... ", cid)
			selfSay("Considering their expected number, there is no chance for us to beat them off. We might be able to hold our ground for a while, but without access to the surface and under constant attacks, we might have to abandon the base. ... ", cid, true)
			selfSay("Now, I'm aware that you cannot stop an entire army by yourself, but desperate situations call for desperate measures. I ask you to find the leaders of the orcs and ..., well do something. ...", cid, true)
			selfSay("Scare them, bribe them, give them another target or whatever. As futile as it may sound: Try to talk to their leaders in some way and make them stop their attack plans. This is our only hope. ", cid, true)
			setPlayerStorageValue(cid, STORAGE_ONGULF, 17)
		elseif(getPlayerStorageValue(cid, STORAGE_ONGULF) == 20) then
			selfSay("Oh my. What a mess you have gotten yourself into. Well, at least you made it out alive. Whatever the value of a minotaur's promise might be, I guess that is the best we can get. ... ", cid)
			selfSay("Of course all those revelations lead to new problems and a new mission for you. ", cid, true)
			setPlayerStorageValue(cid, STORAGE_ONGULF, 21)
		elseif(getPlayerStorageValue(cid, STORAGE_ONGULF) == 21) then
 
Last edited:
Yes, this storage correct, i'm use lib...
i post only storages.

Code:
STORAGE_PALIMUTH = 250
STORAGE_AZERUS = 260
STORAGE_GOOD = 270
STORAGE_BAD = 280
STORAGE_MORIK = 290
STORAGE_CROWBAR = 300
STORAGE_GUARD = 310
STORAGE_NOTES = 320
 
Back
Top