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

Solved quest npc wont "finish" quest

ziggy46802

Active Member
Joined
Aug 19, 2012
Messages
418
Reaction score
27
Here is the script

LUA:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
 
-- OTServ event handling functions start
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 onPlayerEndTrade(cid)				npcHandler:onPlayerEndTrade(cid) end
function onPlayerCloseChannel(cid)			npcHandler:onPlayerCloseChannel(cid) end
-- OTServ event handling functions 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
 
 
	--------------------------------
	------- NPC MISION  2.5 --------
	---by Acubens, great scripter---
	-----modified by Ziggy46802-----
		   -- Otland.net --
	--------------------------------
 
	local first = {
	-- Place true if you want experience to be part of the quest reward, false if only an item. Place true if you want both
	useExpReward = true,
	-- The experience, if above is set to true, that the player will receive as a reward for the quest
	experience = 2500,
	-- Item ID of the "quest item", or the item that the npc takes from you for you to complete the quest
	item = 4852,
	-- Item ID of the second quest item, just leave alone if you only want one item
	itemtwo = 4852,
	-- The quanity, or how many, of the item needed to complete the quest
	item_count = 1,
	-- The quantity, or how many, of the second quest item needed to complete the quest
	itemtwo_count = 1,  
	-- Item ID of the quest reward if the first option is set to false, but an item can be used with true for exp as reward as well 
	reward = 7618,
	-- Item ID of the quest reward if the first option is set to false, this is the second item that can be "not used"
	rewardtwo = 7620,
	-- The quantity, or how many, of the quest reward that the player will receive for the second item upon completion of the quest, can be "not used"
	rewardtwo_count = 10,
	-- The quanity, or how many, of the quest reward that the player will receive upon completion of the quest
	reward_count = 10, 
	-- The storage value that the quest will use (advised would be between 1000 and 10000)
	storage = 1006, 
	--this is the value of the storage value above that is set when the quest is completed, most people use -1 (non existant) for starting the quest and 1 for ending, but I use 2
	last = 2,
	-- The name of the quest which will pop up upon completion of the quest as "You have completed the quest 'quest name'"
	questname = "Blow up the Dwarves"
	}
 
	local npc_message ={
 
	--the number at the front just shows you what number message it is so when you see "npc_message[4]" in the script you know which line of code it refers to
 
	-- 1Message asking if you have the required items, should be something like "Do you have the 10 antennas?" no highlighting is needed
	"Have you blown up all six of the dwarves' pillars?",
	-- 2if you dont have items - message
	"No you havent, you must have missed one, go back and blow them all up.", 
	-- 3thanks - message
	"Thank you for taking my own revenge out on the dwarves for killing my friend. Here are some potions to help you, health wise and mana wise!",
	-- 4Message that the npc says if you have already done the quest
	"The pillars have already been blown up, haven't they?",
	-- 5First message for the quest, should be like "Please go collect 10 chicken feathers for me" and do {} around a word like I did, antennas
	"The dwarves have these crystal pillars, all you have to do to destroy them is to use them since the dwarves count them as sacred and dont use them themselves. They are so old, when touched, or used, they will blow up. Blow up all {six} and come back to me for your reward.",
	-- 6Message given upon completion of the quest, the npc does not say it, it is another type of text
	"Congratulations, you have finished the quest "..first.questname..""
 
	}
 
 
	if(msgcontains(msg, 'blow')) then --the first keyword, should be a word that the xml file for the npc says to you upon greeting
		selfSay(npc_message[5], cid)
	end

if(msgcontains(msg, 'six')) then --the second keyword, should be the {highlighted} word from the "5First message"
	selfSay(npc_message[1], cid)
	talkState[talkUser] = 1
elseif(msgcontains(msg, 'yes')) and talkState[talkUser] == 1 and ((getPlayerStorageValue(cid, 3001) == 2) and (getPlayerStorageValue(cid, 3002) == 2) and (getPlayerStorageValue(cid, 3004) == 2) and (getPlayerStorageValue(cid, 3005) == 2) and (getPlayerStorageValue(cid, 3006) == 2) and (getPlayerStorageValue(cid, 3007) == 2)) 
--and getPlayerStorageValue(cid, 1003) == 2 
then --this is just saying what happens if you say yes to the "do you have the items" message
	if (getPlayerStorageValue(cid,first.storage) == first.last) then --this is checking if you have already done the quest, if you want it repeatable, then set first.last to something like 100, so that it will "never" be done basically, but only set it to 100 on this line, not in the config, make sure it and first.last are different if you want it repeatable
		selfSay(npc_message[4], cid) 
	else
		if ((getPlayerStorageValue(cid, 3001) == 2) and (getPlayerStorageValue(cid, 3002) == 2) and (getPlayerStorageValue(cid, 3004) == 2) and (getPlayerStorageValue(cid, 3005) == 2) and (getPlayerStorageValue(cid, 3006) == 2) and (getPlayerStorageValue(cid, 3007) == 2))--you don't need to edit this, it pulls the item required for the quest from the config at the start 
		--and --remove the commenting dashes at the front of this line if you want multiple items for the items required for the quest, or you can use or instead of and if you want the person to be able to turn in one or the other item to complete the quest
		--(doPlayerRemoveItem(cid,first.itemtwo,first.itemtwo_count)) --remove the commenting dashes at the front of this line if you want two items
		then
			setPlayerStorageValue(cid,1006,2) --this sets the storage value so that the quest is "done" and can not be done again
			if(useExpReward) then
				doPlayerAddExperience(cid,first.experience)
				doPlayerAddItem(cid,first.reward,first.reward_count)
				doPlayerAddItem(cid,first.rewardtwo,first.rewardtwo_count) --comment this line if you want true as exp as reward and only exp as the reward, no item included too
			else
				doPlayerAddExperience(cid,first.experience)
				doPlayerAddItem(cid,first.rewardtwo,first.rewardtwo_count)
				doPlayerAddItem(cid,first.reward,first.reward_count) --comment this line if you want true as exp as reward and only exp as the reward, no item included too

			end
			selfSay(npc_message[3], cid) --this is all the completion of the quest and the thank you and the "you completed quest blah" stuff
			doSendMagicEffect(getCreaturePosition(cid), 10)
			doCreatureSay(cid, npc_message[6], TALKTYPE_ORANGE_1)
		else
			selfSay(npc_message[2], cid) --this is the message you get if you don't have the items required for the quest
		end
	end
return true
end
 
end



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

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

He works all the way up to the point where you say "yes", then he just does nothing. What is wrong with him?

and yes the storages are fine, they are all set to 2 on the character so that's not the problem.

UPDATE -> Wow I feel stupid, just tested the quest on a GM and it does indeed work, I guess my real character just missed a pillar, sorry guys.
 
Last edited:
Back
Top