Multiple Quests

Discussions on development of both the EQ2Emulator LUA Script Engine and Script specifications

Moderator: Team Members

Post Reply
JCL
Posts: 212
Joined: Tue Oct 16, 2007 4:54 pm
EQ2Emu Server: World of Tyrania

Multiple Quests

Post by JCL » Tue Dec 30, 2008 5:15 pm

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.

LethalEncounter
Team: Zombie
Posts: 2717
Joined: Wed Jul 25, 2007 10:10 pm

Re: Multiple Quests

Post by LethalEncounter » Tue Dec 30, 2008 5:17 pm

Use only one spawn script per spawn. You can easily set up conversations that give different quests based on the players selections.

User avatar
Scatman
Retired
Posts: 1688
Joined: Wed Apr 16, 2008 5:44 am
EQ2Emu Server: Scatman's Word
Characters: Scatman
Location: New Jersey

Re: Multiple Quests

Post by Scatman » Tue Dec 30, 2008 5:30 pm

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

JCL
Posts: 212
Joined: Tue Oct 16, 2007 4:54 pm
EQ2Emu Server: World of Tyrania

Re: Multiple Quests

Post by JCL » Tue Dec 30, 2008 7:14 pm

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.

User avatar
Scatman
Retired
Posts: 1688
Joined: Wed Apr 16, 2008 5:44 am
EQ2Emu Server: Scatman's Word
Characters: Scatman
Location: New Jersey

Re: Multiple Quests

Post by Scatman » Thu Jan 01, 2009 2:59 pm

Lol ya sorry I forgot the second "end" in the nested if statement. Leave it to me to forget ends or parenthesis's.

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: Multiple Quests

Post by John Adams » Thu Jan 01, 2009 3:01 pm

I am submitting a patent for what I call "ScatScript".

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


~runs~

JCL
Posts: 212
Joined: Tue Oct 16, 2007 4:54 pm
EQ2Emu Server: World of Tyrania

Re: Multiple Quests

Post by JCL » Thu Jan 01, 2009 3:31 pm

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.

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests