Page 1 of 1

[Quests] OfferQuest automatically sets them as complete

Posted: Thu Oct 08, 2009 2:01 am
by bolly
There seems to be a problem with OfferQuest() where it automatically puts it in the Quest Completed box. This causes some problems with QuestIsComplete where it will return true if the person has only just picked up the quest.

You will also notice that even when on an active quest it is also listed in the completed box.

I can work around it by not checking for QuestIsComplete for now so it's not overly major :-)

Re: [Quests] OfferQuest automatically sets them as complete

Posted: Thu Oct 08, 2009 8:37 am
by Scatman
Hmm, I'm not able to reproduce this. The QuestIsComplete function is all maintained internally (ie. it won't break when structs are changed) so this should not have changed. Would you mind posting your quest script?

Re: [Quests] OfferQuest automatically sets them as complete

Posted: Thu Oct 08, 2009 12:09 pm
by bolly
Aye no bother

Code: Select all

function spawn(NPC)
	ProvidesQuest(NPC, 2)
	--Syntax is NPC, x, y, z, speed, delay (in seconds)
	MovementLoopAddLocation(NPC, -233.71,-1.32,-78.60,1,1)
	MovementLoopAddLocation(NPC, -199.22,-1.30,-65.10,1,1)
	MovementLoopAddLocation(NPC, -181.13,1.42,-39.81,1,1)
	MovementLoopAddLocation(NPC, -157.08,0.21,-37.07,1,1)
	MovementLoopAddLocation(NPC, -140.16,-1.51,-17.05,1,1)
	MovementLoopAddLocation(NPC, -125.01,-1.03, 13.01,1,1)
	MovementLoopAddLocation(NPC, -119.43,-2.52, 22.60,1,1)
	MovementLoopAddLocation(NPC, -65.02,-2.52,90.91,1,1)
	MovementLoopAddLocation(NPC, -47.82,-2.52,128.37,1,1)
	MovementLoopAddLocation(NPC, -32.20,-2.49,126.53,1,1)
	MovementLoopAddLocation(NPC, -31.45,-2.38,126.15,1,1)
	MovementLoopAddLocation(NPC, -12.74,-2.38,127.41,1,1)
	MovementLoopAddLocation(NPC, 8.35,-2.38,115.70,1,1)
	-- water
	MovementLoopAddLocation(NPC,9.91,-4.89,115.10,1,1)
	MovementLoopAddLocation(NPC,12.99,-4.72,110.96,1,1)
	MovementLoopAddLocation(NPC,6.28,-4.67,40.30,1,1)
	MovementLoopAddLocation(NPC,3.83,-1.78,15.99,1,1)
	MovementLoopAddLocation(NPC,-49.88,-1.91,-6.65,1,1)
	MovementLoopAddLocation(NPC,-143.41,-2.54,-70.24,1,1)
	MovementLoopAddLocation(NPC,-147.62,-0.21,-88.47,1,1)

	MovementLoopAddLocation(NPC,-165.80,-0.43,-91.04,1,1)
	MovementLoopAddLocation(NPC,-192.28,-0.88,-110.35,1,1)
	MovementLoopAddLocation(NPC,-241.93,-1.32,-116.01,1,1)
	MovementLoopAddLocation(NPC,-240.83,-4.77,-100.04,1,1)

end
function attacked(NPC, Spawn)
	Emote(NPC, "I shall not let you endanger our people.")
end
function hailed(NPC, Spawn)
	FaceTarget(NPC, Spawn)
	PlayFlavor(NPC, "voiceover/english/voice_emotes/greetings/greetings_1_1002.mp3", "", "", 0, 0, Spawn)
	conversation = CreateConversation()
	if HasQuest(Spawn, 2) then
		-- not functioning, skip for now
		--if QuestIsComplete(Spawn, 2) then
		--	AddConversationOption(conversation, "Great!")
		--	StartConversation(conversation, NPC, Spawn, "Hello " .. GetName(Spawn) .. ", this information is most useful indeed.")

				-- todo: give second quest
		--else
			-- temporary work around

			AddConversationOption(conversation, "Not yet!")
			StartConversation(conversation, NPC, Spawn, "Hello again " .. GetName(Spawn) .. ".  have you recovered more information?")
		--end
	else 
		if HasCompletedQuest(Spawn, 2) then
			AddConversationOption(conversation, "Hello!")
			StartConversation(conversation, NPC, Spawn, "Hello again " .. GetName(Spawn) )	
		else
			AddConversationOption(conversation, "More of us?", "MoreOfYou")
			StartConversation(conversation, NPC, Spawn, "Hmm! How perculiar, another one of you! This is getting stranger and stranger by the day.")
		end
	end
end

function MoreOfYou(NPC, Spawn)
	conversation = CreateConversation()
	AddConversationOption(conversation, "I have no memory of my past or where I came from, but I would like to find out.", "FindOut")
	StartConversation(conversation, NPC, Spawn, "Yes, several nights ago there was one such as yourself that appeared as if out of the ether onto the Docks. The only other outsiders that have arrived here came by a more traditional means. Where did you come from?")
end

function FindOut(NPC, Spawn)
	conversation = CreateConversation()
	AddConversationOption(conversation, "Perhaps I can help you and recover my memories. I will prove myself if you can tell me what to do.", "ProveMyself")
	StartConversation(conversation, NPC, Spawn, "Yes that is exactly what the others said. As sworn protector of Hoa`Kar it is my duty to ensure the safety of all residents here and until we uncover where you and your people are coming from then I can not rest. I cannot trust any of you until more information can be provided and if you cannot recall then this leaves us both in a predicament.")
end

function ProveMyself(NPC, Spawn)
	conversation = CreateConversation()
	AddConversationOption(conversation, "That sounds like a good idea, where can I find them?", "FindThem")
	StartConversation(conversation, NPC, Spawn, "Hmm, very well. Perhaps you should engage in some dialogue with the others that arrived perhaps one of them might help your memories return.")
end

function FindThem(NPC, Spawn)
	conversation = CreateConversation()
	AddConversationOption(conversation, "Very well. Take care Alexander.", "TalkToOthers")
	StartConversation(conversation, NPC, Spawn, "We have temporarily housed them in one of the spare villas at North side of the village. Come back to me when you find out more.")
end


function TalkToOthers(NPC, Spawn)
	OfferQuest(NPC, Spawn, 2)
	conversation = CreateConversation()
	StartConversation(conversation, NPC, Spawn, "Let's hope for whatever reason you uncover, it is the truth.")
	Emote(NPC, " waves.", Spawn)
end


function death(NPC, Spawn)
	Say(NPC, "There is peace in all.")
end
function killed(NPC, Spawn)
	Say(NPC, "We promise to ensure your body and spirit passes safely to the other side.")
end

Re: [Quests] OfferQuest automatically sets them as complete

Posted: Thu Oct 08, 2009 12:11 pm
by Scatman
Can you post the quest script?

Re: [Quests] OfferQuest automatically sets them as complete

Posted: Thu Oct 08, 2009 12:17 pm
by bolly
There ya go

Code: Select all

--[[
--]]

function Init(Quest)
	RegisterQuest(Quest, "Recover the Past", "Hallmark", "Hoa`Kar", 1, "You are to recover information for Alexander")
	SetQuestRewardExp(Quest, 200)
	SetQuestPrereqLevel(Quest, 1)
	SetCompletedDescription(Quest, "You recovered information regarding your past")
end

function Accepted(Quest, QuestGiver, Player)
	
end


function Declined(Quest, QuestGiver, Player)
	if QuestGiver ~= nil then
		if GetDistance(Player, QuestGiver) < 30 then
			FaceTarget(QuestGiver, Player)
			Say(QuestGiver, "For the sake of our trust " .. GetName(Player) .. ", I suggest you seize this opportunity.")
		end
	end
end



Re: [Quests] OfferQuest automatically sets them as complete

Posted: Thu Oct 08, 2009 2:29 pm
by Scatman
So there is you problem. You do not define any steps in your init function therefore your quest has no steps meaning it is complete from the start.

Re: [Quests] OfferQuest automatically sets them as complete

Posted: Thu Oct 08, 2009 11:49 pm
by bolly
Ahhh that makes more sense! Here's the step functions for anyone else who had this prob:

AddQuestStepKill(Quest, Step ID, Description, Quantity, Percentage, TaskGroupText, Icon, NPC ID(s))
NOTE: ID is a unique number that you want to use for this step. It is used later to track player progress. Each quest can use whichever IDs you want as long as the ID is not repeated in the same quest.
TaskGroupText is optional, but if used this Quest Step will be a bullet underneath the TaskGroup created with the TaskGroupText.
If you dont want to use TaskGroupText use an empty string in the field (ie "")
You can have multiple bullets under the same TaskGroup by using the same TaskGroupText in multiple addQuestStepKill function calls.

AddQuestStepChat(Quest, Step ID, Description, Quantity, TaskGroupText, Icon, NPC ID(s))

AddQuestStepObtainItem(Quest, Step ID, Description, Quantity, Percentage, TaskGroupText, Icon, Item ID(s))

AddQuestStepLocation(Quest, Step ID, Description, MaxVariation, TaskGroupText, Icon, (X, Y, Z)(s))
NOTE: MaxVariation is the distance the player can be from the location and still get credit

AddQuestStep(Quest, Step ID, Description, Quantity, Percentage, TaskGroupText, Icon)

AddQuestStepCompleteAction(Quest, Step ID, Function Name)
NOTE: LUA Function that is called when this step is completed.

Scatman: Edited these to the current since they are horribly outdated in the LUA functions post :|

Re: [Quests] OfferQuest automatically sets them as complete

Posted: Fri Oct 09, 2009 1:13 am
by bolly
Scatman: Modified AddQuestStepChat to accept a quantity parameter. AddQuestStepChat(Quest, StepID, StepText, Quantity, TaskGroupText, Icon, ID(s))
(from changelog)

Re: [Quests] OfferQuest automatically sets them as complete

Posted: Fri Oct 09, 2009 2:17 am
by bolly

Re: [Quests] OfferQuest automatically sets them as complete

Posted: Fri Oct 09, 2009 5:30 am
by Scatman
Nice Bolly, thanks a lot.