alissonfgp
LUA, C, C++, C#
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?
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: