Sorry it took me so long to respond, I've been busy in my life outside of my game development, I nearly forgot about this topic.
Anyways, this quest idea is an experiment in a more complex case-based system. A simpler, straight-forward (mini)quest in my game is like this:
var fireLily = 0;
function priestFL()
{
switch (fireLily)
{
case 0:
Text("Priest: \n\n\tOh, Ilxder! I was looking for you earlier. You see, my first anniversary with my wife is tomorrow, and I'd like to get her something nice. Do you have some time to spare? \n\nYou: \n\n\tSure, what do you need? \n\nPriest: \n\n\tCould you get a Fire Lily for me? They're a rare flower that only grows on this island. You can find some by walking east along the North Shore. \n\nYou: \n\n\tAlright.");
++fireLily;
break;
case 1:
Text("Priest: \n\n\tHave you acquired a fire lily yet? \n\nYou: \n\n\tNo, not yet. \n\nPriest: \n\n\tPlease, do hurry! I wish to have that flower for tomorrow.");
break;
case 2:
Text("Priest: \n\n\tHave you acquired a fire lily yet? \n\nYou: \n\n\tYes, I did. Here it is! \n\n*You hand the flower to the priest* \n\nPriest: \n\n\tThank you so much, Ilxder! Now I can give my wife something really nice - the priestly salary isn't very large, as you can well imagine. \n\n*You have completed the quest: 'Fire Lillies'*");
++fireLily;
break;
case 3:
Text("Priest: \n\n\tThank you for obtaining that flower for me! Can I do anything else for you? \n\nYou: \n\n\tNo, thank you. \n\nPriest: \n\n\tAlright. Let me know if you need anything more. \n\nYou: \n\n\tI will. Good day! \n\nPriest: \n\n\tTylbur's blessings. \n\n\t* You have completed the Fire Lily side quest *");
break;
}
}
function fireLilyGather()
{
switch (fireLily)
{
case 0:
Text("~ These flowers are beautiful, but I can't think of anything I might need them for ~");
break;
case 1:
Text("*You pick the flower*");
++fireLily;
break;
case 2:
Text("~ I already picked the flower for the priest. I have no other need for them. ~");
break;
case 3:
Text("~ I already picked the flower for the priest. I have no other need for them. ~");
break;
}
}
Whereas, the full quest script for this 'Monkeying Around' is a more complex system, where I have to lay out the plan and which character has new information and during which specific case they HAVE the new info. This is easy to lay out in my head, but it can be easily messed up (and has been) while I've been designing this little quest that appears during the tutorial. Here's the full script that I have so far:
var monkeyingAround = 0;
function captainTalk()
{
switch (monkeyingAround)
{
case 0:
Text("Captain:\n\n\tPlease address all of your concerns to the office of the.. oh, Ilxder sir! I've been getting too many complaints from the merchants in the market about some sort of thief taking all of their products. So what can I do for you, sir? \n\nYou: \n\n\tI could look into that issue for you. \n\nCaptain: \n\n\tWould you? I'd definitely be grateful. \n\nYou: \n\n\tSure! \n\n* This is an investigation-style quest. You will encounter many of these quests throughout your time on Steorth. *");
++monkeyingAround;
break;
case 1:
Text("Captain:\n\n\tDid you look into the thefts from the marketplace yet? \n\nYou: \n\n\tNo, not yet. \n\nCaptain: \n\n\tPlease try to look into the issue as soon as possible.");
break;
case 2:
Text("Captain:\n\n\tDid you look into the thefts yet? \n\nYou: \n\n\tI'm currently gathering info from the merchants on the thefts. \n\nCaptain: \n\n\tVery good. Please report back to me if you find anything out.");
break;
case 3:
Text("Captain:\n\n\tAnything new? \n\nYou: \n\n\tYes. I spoke to some of the merchants, and from what I gather, it's not a human thief, but an animal. \n\nCaptain: \n\n\tAn animal, you say? Hmm, strange. Anything else? \n\nYou: \n\n\tI'm afraid not, yet.");
case 4:
Text("Captain: \n\n\tFind anything more about the thefts yet? \n\nYou: \n\n\tYes, I have. It turns out that a little monkey, presumably from the eastern end of the Island, has been sneaking into the buildings around the square and apparently stealing the merchandise. \n\nCaptain: \n\n\tA monkey? That's odd, they usually keep to themselves. Well done, thanks for the help. We'll keep an eye out for the little critters in the future. \n\n* You've completed 'Monkeying Around'! *");
++monkeyingAround;
break;
case 5:
Text("Captain: \n\n\tThank you for investigating that issue for me. \n\nYou: \n\n\tNo trouble at all, Captain. I always like to see things going well on Halmuna. \n\nCaptain: \n\n\tIndeed. I'll be sure to call for you if I need help in the future!");
}
}
function bradleyTalk()
{
switch (monkeyingAround)
{
case 0:
Text("Chef: \n\n\tWelcome to Bradley's Bakery! I'm Bradley. Can I help you? \n\nYou: \n\n\tMmm, what are you cooking? It smells excellent. \n\nBradley: \n\n\tI'm baking a special recipe of mine - ring cake. See, it's basically just dough and honey, and I make it in a circular shape, like a ring! They are excellent with milk. \n\nYou: \n\n\tSounds great, I'll have to remember that! Good-bye. \n\nBradley: \n\n\tCome again soon!");
break;
case 1:
Text("Bradley: \n\n\tHello, sir! How may I help you today? \n\nYou: \n\n\tHello, I'm investigating a series of thefts from the marketplace. Is there any information you can provide to me about the issue? \n\nBradley: \n\n\tHmm, come to think of it, I HAVE been missing several sacks of flour recently. Not sure what thief would take something as cheap as flour. \n\nYou: \n\n\tThanks, I'll work from that.");
++monkeyingAround;
break;
case 2:
Text("Bradley: \n\n\tDid you find any more evidence concerning the thefts yet? \n\nYou: \n\n\tNo, not yet. If you find any new evidence, please let either myself or the Captain of the Guard know. \n\nBradley: \n\n\tCan-do, sir!");
break;
case 3:
Text("Bradley: \n\n\tDid you find out any more about the thefts? \n\nYou: \n\n\tYes, but not much. It's not a human that's stealing the merchandise, but a creature, reportedly with a small tail. \n\nBradley: \n\n\tThat is really strange. I'll be sure to keep an eye out for anything suspicious! \n\nYou: \n\n\tThank you, Bradley.");
case 4:
Text("Bradley: \n\n\tDid you find any more evidence concerning the thefts yet? \n\nYou: \n\n\tYes, actually, I did. It turns out a monkey has been stealing things from the merchants in the marketplace. \n\nBradley: \n\n\tA monkey? I thought they didn't come this far west. \n\nYou: \n\n\tI thought the same, but apparently that's not the case. Perhaps one of the local residents owns one as a pet.");
break;
case 5:
Text("Bradley: \n\n\tWelcome back, sir! \n\nYou: \n\n\tHello, Bradley. Had any more run-ins with monkeys recently? \n\nBradley: \n\n\tNo, everything has been really quiet recently. Thanks for asking though!");
break;
}
}
function richardTalk()
{
switch (monkeyingAround)
{
case 0:
Text("Richard: \n\n\tHello, good sir, and welcome to Richard's Research Lab! Is there anything I can help you with? \n\nYou: \n\n\tNot at the minute, but thank you very much, Richard! \n\nRichard: \n\n\tAlright, feel free to speak to me if you change your mind.");
break;
case 1:
Text("You: \n\n\tRichard, have you seen any suspicious activity recently? I'm investigating a theft issue that has been plaguing the marketplace. \n\nRichard: \n\n\tNo, I can't say I have, sir. \n\nYou: \n\n\tVery well. If you see anything suspicious, please report it to either myself, or the Captain of the Guard.");
break;
case 2:
Text("You: \n\n\tHave you seen anything suspicious recently, Richard? \n\nRichard: \n\n\tYes, sir, I caught only a glimpse of what appeared to be a small tail on a creature as it left my store. \n\nYou: \n\n\tA tail... hmm, I'll speak to the other people around here and see if they have any possible ideas of what this could be about.");
++monkeyingAround;
break;
case 3:
Text("Richard: \n\n\tDid you happen to find anything yet? \n\nYou: \n\n\tNo, not yet. I'm still asking the others around here. \n\nRichard: \n\n\tPlease hurry and solve this problem. I don't think I can afford my medicine being stolen constantly like this!");
break;
case 4:
Text("Richard: \n\n\tDid you happen to find anything yet? \n\nYou: \n\n\tYes, it turns out this creature is just a monkey! \n\nRichard: \n\n\tA monkey?? Here? Why? \n\nYou: \n\n\tI know about as much as you do, on that aspect. I'm going to report it to the captain.");
break;
case 5:
Text("You: \n\n\tHave you had any more issues with theft recently? \n\nRichard: \n\n\tNo, sir! Thank you for sorting this all out!");
break;
}
}
Of course, this is still a work-in-progress.
The thing I often have a problem with, in implementing others' scripts and libraries in my game, is that certain functions and variables may not be properly defined, or it may be just a different coding style, so I'd have a harder time implementing it myself. I suppose, since I'm not that great at programming, that my coding style is probably not very good, but I'd say it's probably too late in the game's progress to redo it all. Perhaps for my next Sphere project, things will be programmed better.
@DaVince - Your example makes sense to me, but I think I'd essentially be doing the same thing as before, in just a different style - like, I'd still be writing 'case 0', 'case 1', 'case 2' and so forth, right? I'm not sure, as I said, I still have a hard time programming with things, even after experimenting with it and reading books for nearly the past four years.
EDIT: Honestly, I can work out most of the logic of programming, particularly in JS, but it's the actual coding process that I have problems with. Just an FYI.