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

arbixa

New Member
Joined
Mar 22, 2010
Messages
7
Reaction score
0
Location
Sweden
So here's the thing, everything works fine but when I get to mission 5 and write mission he doesn't answer. :(


My code:
PHP:
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 storageChildren = 8823 -- Storagevalue Children of the Revolution Quest (finished = 2)
	local storageWrath = 42324 -- Storagevalue Wrath of the Emperor (finished = )
	local storage = getPlayerStorageValue(cid, 93800)
    local storagee = getPlayerStorageValue(cid, 93802)
	local mark1 = {x = 33356,y = 31180, z = 7} -- First mark (entrance)(Wrath)
	local mark2 = {x = 33173,y = 31075, z = 7} -- Second mark (Wrath)	


			-------------------- Wrath of the Emperor -----------------
		if (getPlayerStorageValue(cid,storageWrath) == 0) then
	
			if(msgcontains(msg, 'mission')) then
				npcHandler:say({'Zze attackzz have weakened our enemy zzignificantly. Yet, your quezzt continuezz. Bezzidezz zzome tazzkzz you could take, zze zzreat of zze {emperor} izz zztill hanging over our headzz like a rain cloud. ...','Zzo, are you indeed willing to continue zze fight for our cauzze?'}, cid)
				talkState[cid] = 1
		
			elseif(msgcontains(msg, 'yes') and talkState[cid] == 1) then
				npcHandler:say({'You continue to imprezz, zzoftzzkin ...','A contact of zze rezzizztanzze izz located furzzer in zze norzz of Zao ...','Zze emperor will drag hizz forzzezz to zze {great gate}  now to bolzzter hizz defenzze. Zzinzze we attacked zze gate directly, he will not expect uzz taking a completely different route to reach zze norzzern territoriezz. ...','I azzume you are already geared up and ready to conquer zze norzz?'}, cid)
				talkState[cid] = 2
		
			elseif(msgcontains(msg, 'yes') and talkState[cid] == 2) then	
				npcHandler:say({'Your determination izz highly appreciated. To zzneak pazzt zze eyezz of zze enemy, you will have to uzze a diverzzion. Zzere are zzeveral old {tunnelzz}h beneazz zze zzoil of Zzao. ...','One of zzem izz uzzed azz a maintenanzze connection by enemy lizardzz. To enter it, you will have to uzze a dizzguizze. Zzomezzing like a crate perhapzz.','Mh, if you can find zzome nailzz - 3 should be enough - and 1 piezze of wood, I should be able to create an appropriate cazzing. Return to me if you found zze itemzz and we will talk about zze next zztep.'}, cid)
				talkState[cid] = 0
				setPlayerStorageValue(cid,storageWrath,1)		
			end
		
		elseif (getPlayerStorageValue(cid,storageWrath) == 1) then
		
			if(msgcontains(msg, 'mission')) then
				npcHandler:say({'Ah you have returned. I azzume you already found zzome itemzz to {build} a proper dizzguizze?'}, cid)
				talkState[cid] = 1
			elseif(msgcontains(msg, 'yes') and talkState[cid] == 1) then
			if(getPlayerItemCount(cid, 5901) >= 1 and getPlayerItemCount(cid, 8309) >= 3) then
				npcHandler:say({'Very good, I am confident zzizz will zzuffizze. Now I can {build} and mark a {crate} large enough for you to fit in - while zztill being able to breazze of courzze - and I will mark it in our tongue zzo it will look lezz zzuzzpizziouzz. ...','Wizz zzeir eyezz towardzz zze {gate}, your chanzzezz to zzlip zzrough have never been better. I will keep zze zzpare materialzz here wizz me, we can alwayzz {build} a new one if you need to.'}, cid)
				talkState[cid] = 2
			else	
				npcHandler:say({'Mh, if you can find zzome nailzz - 3 should be enough - and 1 piezze of wood, I should be able to create an appropriate cazzing. Return to me if you found zze itemzz and we will talk about zze next zztep.'}, cid)
				end
			elseif(msgcontains(msg, 'crate') and talkState[cid] == 2) then		
				npcHandler:say({'Ah I zzee. You are ready for your mizzion and waiting for me to create and mark zze crate?'}, cid)
				talkState[cid] = 3
			elseif(msgcontains(msg, 'yes') and talkState[cid] == 3) then		
				npcHandler:say({'Alright. Let uzz create a crate. Hm. Let me zzee. ...','Good. Zzat will do. ...','Zze maintenanzze tunnelzz are in zze eazzt of zze plainzz, near ze coazt. Here, I will mark zzem on your map. ...','Uzze zze dizzguizze wizzely, try to hide in zze dark and avoid being zzeen at all cozzt. ...','Onzze you have reached zze norzz, you can find zze rezzizztanzze hideout at zze ozzer zzpot I marked on your map. Now hurry.'}, cid)
			if doPlayerRemoveItem(cid,5901,1) and doPlayerRemoveItem(cid,8309,3) then
				doPlayerAddItem(cid,12245,1)
				setPlayerStorageValue(cid,storageWrath,2)
				doPlayerAddMapMark(cid, mark1, MAPMARK_CROSS, 'Maintenance Tunnel Entry')
				doPlayerAddMapMark(cid, mark2, MAPMARK_CROSS, 'Resistance Hideout')
				talkState[cid] = 0
				end
			end
				-------------------- MISSION 2 ----------------
		elseif (getPlayerStorageValue(cid,storageWrath) == 2) and (getPlayerStorageValue(cid,42830) == 2) then
		
			if(msgcontains(msg, 'mission')) and (getPlayerStorageValue(cid,42830) == 2 and getPlayerStorageValue(cid,storageWrath) == 2) then
				npcHandler:say({'You ezztablished zze connection to zze hideout, good. But zzizz izz no time to rezzt. Your new tazzk will be quite different. ...','Zze gardenzz are plagued by a creature. Zze former keeper of zzizz garden became an abomination of madnezz zzat needzz to be zztopped. ...','He hidezz deep underground and it will be dangerouzz to challenge him in hizz lair but I am willing to rizzk it. ...','Find him, dezztroy him, bring me hizz - I uhm, mean it izz utterly nezzezzary for you to deliver me a proof of hizz deazz. ...','Now go - what are you waiting for, zzoftzzkin? Ready to finish what needzz to be finished?'}, cid)
				talkState[cid] = 1
			elseif(msgcontains(msg, 'yes') and talkState[cid] == 1) then
				npcHandler:say({'Fine. I guezz poizzoning zzome of hizz plantzz will be enough to lure him out of hizz conzzealment. Zzizz plant poizzon here should allow you to do zzome zzignificant damage, take it. ...','You can find him eazzt of zze corrupted gardenzz. Zzere uzzed to be a zzmall domizzile zzere but it hazz probably been conzzumed by zze corruption zzo beware. And now - go.'}, cid)
				doPlayerAddItem(cid,12281,1)
				talkState[cid] = 0
			end
				-------------------- MISSION 3 ----------------
		elseif (getPlayerStorageValue(cid,42830) == 2 and getPlayerStorageValue(cid,storageWrath) == 3) then
			if(msgcontains(msg, 'mission')) then
				npcHandler:say({'Zzo... you finished him. Show me hizz head, will you?'}, cid)
				talkState[cid] = 4
			elseif(msgcontains(msg, 'yes') and talkState[cid] == 4 and getPlayerItemCount(cid, 12284) >= 1) then
				npcHandler:say({'Zzizz izz not hizz head but clearly belonged to zze keeper. I - I am imprezzed. You can go now. Leave me alone for a zzecond.'}, cid)
				setPlayerStorageValue(cid,storageWrath,4)
				doPlayerRemoveItem(cid, 12284, 1)
				talkState[cid] = 0
			end
					
				-------------------- MISSION 4 ----------------
		elseif (getPlayerStorageValue(cid,42830) == 2 and getPlayerStorageValue(cid,storageWrath) == 4 and getPlayerStorageValue(cid,12288) == -1) then
			if(msgcontains(msg, 'mission')) then
				npcHandler:say({'At zze dawn of time, zze children of zze Great Zznake were numerouzz. Zzey daringly colonizzed many partzz of zze world. But all bravery did not help againzzt zze sheer number of enemiezz zzey encountered. ...','And while zze entitiezz zze unbelieverzz call godzz battled for power out of vanity, zze fazze of zze world changed violently. ...','Many zzentrezz of our magnifizzent zzivilizzation were dezztroyed and only two realmzz zzat we know of remained intact but lozzt contact to each ozzer. ...','In vizzionzz, zze Great Zznake revealed to Zalamon zze exzzizztenzze of ozzer lizzard people in a vazzt jungle in a far away land. ...','Zzough zze lizardzz of zze land failed zze Great Zznake and lozzt itzz favour, zzey are zztill in pozzezzion of ancient reliczz of immenzze power, onzze imbued by zze Great Zznake himzzelf. ...','I had vizzionzz of an - item. Yezz. It may be uzzeful for uzz - I mean you, ezzpecially you. ...','We need a zzeptre of power zzat can be found in zze underground of an ancient temple. It hazz been overrun by zzavage apezz and you will have to fight zzem and zze ancient guardianzz of zze temple azz well. Get uzz zzat zzeptre wherever it might be. ...','It wazz revealed zzat it hazz been zzplit into 3 partzz for reazzonzz zzat are of no importanzze anymore. Zzizz powerful devizze could help uzz in our battle againzzt zze emperor. ...','A shaft, a cuzzp, and an emerald form a zzeptre of zzuch power zzat zze partzz were hidden and are now guarded by vile creaturezz. ...','Find it. Retrieve it. And bring it back to me.'}, cid)
				setPlayerStorageValue(cid,82382,1)
				setPlayerStorageValue(cid,12288,1)
				talkState[cid] = 0
			end
				
		elseif (getPlayerStorageValue(cid,42830) == 2 and getPlayerStorageValue(cid,storageWrath) == 4 and getPlayerStorageValue(cid,12288) == 4) then
				if(msgcontains(msg, 'mission')) then
					npcHandler:say({'You - azzembled zze zzeptre? Hand it out, give it to me, will you?'}, cid)
					talkState[cid] = 5
					elseif(msgcontains(msg, 'yes') and talkState[cid] == 5) then
			if(getPlayerItemCount(cid, 12288) >= 1 ) then
				npcHandler:say({'Finally. At lazzt. Zze zzeptre izz - ourzz. Ourzz of courzze. A weapon we should uzze wizzely for our cauzze. I need a zzecond or two. Do you leave me already?'}, cid)
				setPlayerStorageValue(cid,storageWrath,5)
				doPlayerRemoveItem(cid, 12288, 1)
				talkState[cid] = 0
			end
				-------------------- MISSION 5 ----------------
		elseif (getPlayerStorageValue(cid,42830) == 2 and getPlayerStorageValue(cid,storageWrath) == 5 and getPlayerStorageValue(cid,12288) == 4) then
			if(msgcontains(msg, 'mission')) then
				npcHandler:say({'Now we need to get clozzer to zze emperor himzzelf. A hive of beezz would defend zzeir queen wizz zzeir lives in cazze an enemy gained entranzze. Zzizz makezz a formidable defenzze line, nearly inviolable. ...','But a zztranger directly in zze midzzt of zze hive will be acczzepted - after all it izz not pozzible to overcome zzuch a formidable defenzze which izz nearly inviolable, or izz it? Ha. ...','Now zzat you overcame zzeir linezz of defenzze at zze great gate, you only need to find a way to enter zzeir home. ...','Head zztraight to zze entranzze of zze zzity. If you can convinzze zze guardzz to let you enter zze zzity, you should be able to reach our contact zzere wizz eazze. ...','We have alzzo forged zome paperzz for you and zzent zzem to zze zzity. Your victory in zze arena iz well known in our land. Wizz zze help of zzezze paperzz you will pretend zzat zzome of zze higher officialzz want to talk to you about your battle. ...','Zzizz way you will be able to enter zze zzity of zze dragon emperor and meet our contact zzere in zze imperial offizze. He will give you zze next inzztructionzz.'}, cid)
				setPlayerStorageValue(cid,23382,1)
			end

			end	
		end
	return true
end

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