Untitled

 avatar
unknown
plain_text
3 years ago
4.1 kB
6
Indexable
 local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

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

local function creatureSayCallback(cid, type, msg)
	if not npcHandler:isFocused(cid) then
		return false
	end
	
	if msgcontains(msg, "mission") or msgcontains(msg, "report") then
		if player:getStorageValue(Storage.TheBirthofaWarrior.Questline) < 1 then
			npcHandler:say("c..ca..n h..he...lpp?", cid)
			npcHandler.topic[cid] = 2
		elseif player:getStorageValue(Storage.TheBirthofaWarrior.Questline) == 1 then -- Nueva mision
			npcHandler:say("ma.....mage......tr..a....ns....l...", cid)
			player:setStorageValue(Storage.TheBirthofaWarrior.Questline, 2)
			player:setStorageValue(Storage.TheBirthofaWarrior.Mission01, 1) -- The Inquisition Questlog- "Mission 1: Investigate"
			npcHandler.topic[cid] = 0
		elseif player:getStorageValue(Storage.TheBirthofaWarrior.Questline) == 2 then
			npcHandler:say("Can you understand what I'm saying now?", cid)
			npcHandler.topic[cid] = 3											
		elseif player:getStorageValue(Storage.TheBirthofaWarrior.Questline) == 14 then -- Nueva mision
			npcHandler:say({
				"Well I need equipment because if he doesn't I can be of help, for that I need you to bring me a wooden shield, a dagger, a studded armor, a leather boots, and a broken helmet. ...",
				"Can u help me?."
			}, cid)
			player:setStorageValue(Storage.TheBirthofaWarrior.Questline, 15)
			player:setStorageValue(Storage.TheBirthofaWarrior.Mission02, 1) -- The Inquisition Questlog- "Mission 2: In Search of Survival"
			npcHandler.topic[cid] = 0
		elseif player:getStorageValue(Storage.TheBirthofaWarrior.Questline) == 15 then
			if player:removeItem(2484, 1) then
			   player:removeItem(2643, 1)
			   player:removeItem(2379, 1)
		       player:removeItem(12409, 1)
			   player:removeItem(2512, 1)
				npcHandler:say({
					"Wow, thanks you so much, now i can fight.",
					"now we must go to the entrance of the castle, i need these wounds to be treated and then we must report what happened"
				}, cid)
				player:setStorageValue(Storage.TheBirthofaWarrior.Questline, 16)
				player:setStorageValue(Storage.TheBirthofaWarrior.Mission02, 2) -- The Inquisition Questlog- "Mission 2: In Search of Survival"
			else
				npcHandler:say("You don't have all the items.", cid)
			end
			npcHandler.topic[cid] = 0
		elseif msgcontains(msg, "yes") then -- nueva misison
		if npcHandler.topic[cid] == 2 then
			npcHandler:say("{mission} h...he..lp", cid)
			player:setStorageValue(Storage.TheBirthofaWarrior.Questline, 1)
			npcHandler.topic[cid] = 0
		elseif npcHandler.topic[cid] == 3 then
			if player:getStorageValue(Storage.TheBirthofaWarrior.HermitWizard) == 1 then
				npcHandler:say("Very Well, i belong to a rookie group of soldiers of our kingdom, me and my team were ambushed by a large group of bandits.	I need your help to be able to rescue my companions, but for that I need equipment since mine was stolen and that you escort me to the entrance of the castle...there are soldiers guarding the entrance, and they could help. Would you help me?.", cid)
				player:setStorageValue(Storage.TheBirthofaWarrior.Questline, 3)
				player:setStorageValue(Storage.TheBirthofaWarrior.Mission01, 7) -- The Inquisition Questlog- "Mission 1: Interrogation"
			else
				npcHandler:say("You haven't done your mission yet.", cid)
				npcHandler.topic[cid] = 0
		end
	return true
end
		
npcHandler:setMessage(MESSAGE_GREET, "|PLAYERNAME|. H.hee..lp.. {mission}")
npcHandler:setMessage(MESSAGE_FAREWELL, "Always be on guard, |PLAYERNAME|!")
npcHandler:setMessage(MESSAGE_WALKAWAY, "This ungraceful haste is most suspicious!") 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Editor is loading...