Page 1 of 1

Multiple Quests

Posted: Tue Dec 30, 2008 5:15 pm
by JCL
I decided to add another quest to an NPC.

Now I was curious for spawn scripts, do I use multiple for one npc or do I fit it all in one. I could not get either way to work and allow for multiple quests. This is the same was if the a target conversation NPC already has a script.

Re: Multiple Quests

Posted: Tue Dec 30, 2008 5:17 pm
by LethalEncounter
Use only one spawn script per spawn. You can easily set up conversations that give different quests based on the players selections.

Re: Multiple Quests

Posted: Tue Dec 30, 2008 5:30 pm
by Scatman
I usually handle NPCs who interact with you on more than a single quest like this:

Let's say:
quest1 id = 1
quest2 id = 2

my spawnscript would look something like this:

Code: Select all

function hailed(NPC, Spawn)
   if HasCompletedQuest(Spawn, 1) then
      if HasCompletedQuest(Spawn, 2) then
         -- completed both quests
      elseif HasQuest(Spawn, 2) then
         -- completed quest 1, has quest 2
      else
         -- completed quest 1, does not have quest 2
   elseif HasQuest(Spawn, 1) then
         -- has quest 1
   else
      -- has no quests, has not completed either
   end
end

Re: Multiple Quests

Posted: Tue Dec 30, 2008 7:14 pm
by JCL
Hmm, yeah that way seems good, I'll give that a try.

Edit: That way gave quite a few "end" errors at "elseif" that I couldn't fix.

I did find a way to get the second quest in though.

Re: Multiple Quests

Posted: Thu Jan 01, 2009 2:59 pm
by Scatman
Lol ya sorry I forgot the second "end" in the nested if statement. Leave it to me to forget ends or parenthesis's.

Re: Multiple Quests

Posted: Thu Jan 01, 2009 3:01 pm
by John Adams
I am submitting a patent for what I call "ScatScript".

These are scripts that usually have a beginning, a middle, but no end.


~runs~

Re: Multiple Quests

Posted: Thu Jan 01, 2009 3:31 pm
by JCL
Thanks for the second End lol.

Yeah I said I got it working, then I remembered I forgot to make it so the quests completes when you turn it back in after the step updates. I added that in and got more end errors near "else" and "if". It's really fun trying to fix that :/... LUA is kind of annoying.