Page 1 of 1

difference in functions

Posted: Wed Aug 10, 2016 10:11 pm
by patrikpatrik
Hi,

is there a difference between QuestIsComplete() and HasCompletedQuest()?

In the walkthrough for quest scripts, Dave.lua has a section of conditionals where:

Code: Select all

if HasQuest(Spawn, 3) then
   -- If the Quest ID 3 has been completed (change this to yours) 
   if QuestIsComplete(Spawn, 3) then
     -- say great to the message below
     AddConversationOption(conversation, "Great!")
     -- say thanks to the player for completing quest 3
     StartConversation(conversation, NPC, Spawn, "Hello " .. GetName(Spawn) .. ", thank you so much for helping me.")
   else
     -- they haven't completed quest 3 ask them to hurry up!
     AddConversationOption(conversation, "Not yet!")
     StartConversation(conversation, NPC, Spawn, "Hello again " .. GetName(Spawn) .. ".  did you give my wife the message yet?")
   end
 else 
   -- they have already finished quest 3 (change this to yours)
   if HasCompletedQuest(Spawn, 3) then
     -- just say hey
     AddConversationOption(conversation, "Hello!")
     -- say hello
     StartConversation(conversation, NPC, Spawn, "Hello again " .. GetName(Spawn) )	
   else...
Here, after completing the quest, Dave never says the section with the option 'Great!' with 'Hello 'name' thank you so much for helping me..' Instead after completion, he says the part near the bottom with the response 'Hello' after 'Hello again GetName(Spawn) '.

So I'm assuming if quest has been completed, then it's no longer available so HasQuest will always be false?

Re: difference in functions

Posted: Wed Aug 10, 2016 11:40 pm
by Jabantiz
Quickly looking over the code for both functions it looks like QuestIsComplete() is for when you have finished every step but have not got the reward yet (still in the active quest tab of the journal) and HasCompletedQuest() is for when every thing is done and you already got the reward (in the completion tab)

And you are correct, when you have completed a quest you no longer have it so HasQuest() will return false.