Setting up Quests in Quest.

Iconaclast
13 May 2020, 22:30

So I'm creating a quest system which has 4 parts.
-Pending: You've found the quest but are too low of a level to start it.
-Unlocked: You are now a high enough level to start this quest, return to the Npc/object who gave it to you.
-Inprogress: You are now in a gamestate where collecting X or doing X will add to your quest progress.
-Completed: You have completed doing/collecting X, return to the Npc or object who gave you quest for reward.
-Done: You have finished every step in this quest.

I also have a Quest Book the player carries around which displays the progress of different quests you've found/completed.

So now for the rough part, I apologize in advance.

I am currently using 2 functions to set booleans which add to and remove from the lists in the quest book. The first one checks attriubutes of a quest and turns the booleans on or off. Here it is.
CheckProgess Function: Takes "quest"

if (quest.qstep = (quest.qstepmax + 1)) {
  if (quest.done = true) {
    msg ("You've already completed this quest<br/>")
  }
  else {
    quest.completed = false
    quest.inprogress = false
    quest.unlocked = false
    quest.pending = false
    quest.done = true
    msg ("You have finished a quest. Well done!<br/>")
  }
}
else if (quest.qstep = quest.qstepmax) {
  if (quest.completed = false) {
    quest.inprogress = false
    quest.unlocked = false
    quest.pending = false
    quest.completed = true
    msg ("You have completed a quest. Return to its giver for a reward.<br/>")
  }
  else {
    msg ("You hear crickets")
  }
}
else if (quest.qstep > 1 and quest.qstep < quest.qstepmax) {
  if (quest.inprogress = false) {
    quest.unlocked = false
    quest.pending = false
    quest.inprogress = true
    msg ("You have started a new quest.<br/>")
  }
  else {
    msg ("The wind blows.<br/>")
  }
}
else if (player.lvl >= quest.lvl) {
  if (quest.unlocked = false) {
    quest.unlocked = true
    quest.pending = false
    msg ("You have unlocked a new quest.<br/>")
  }
}
else if (ListContains(ScopeVisible(), quest)) {
  if (quest.pending = false) {
    quest.pending = true
    msg ("You have a new pending quest.<br/>")
  }
}

The second one Adjusts the variables of the quest and displays a string that is set in the quest attributes. Here it is.
QuestCheck Function: Takes "quest"

if (quest.done = true) {
  msg (quest.donestring)
  quest.started = false
}
else if (quest.completed = true) {
  msg (quest.completedstring)
  reward (quest)
  quest.qstep = quest.qstepmax + 1
}
else if (quest.inprogress = true) {
  msg (quest.inprogressstring)
  if (quest.comp >= quest.compmax) {
    questcost (quest)
    quest.qstep = quest.qstepmax
  }
  else {
    msg ("You have "+ quest.comp + "/" + quest.compmax + quest.compstring + "<br>")
  }
}
else if (quest.unlocked = true) {
  msg (quest.unlockedstring)
  quest.qstep = quest.qstep + 1
  quest.started = true
}
else if (quest.pending = true) {
  msg (quest.pendingstring)
}
else {
  msg (quest.initalstring)
}
checkprogress (quest)

The "reward" and "questcost" functions just check which is being named then gives a reward or takes an item based on the quest they receive.
Each of the booleans have a changescript which updates the Quest Book list. They all look similar to this.
Boolean changescript meetbubbles is the name of the questobject(Yes I know Meat Bubbles and meetbubbles are spelled differently)

if (meetbubbles.pending = true) {
  list add (pending.list, "Meat Bubbles")
  meetbubbles.pendingstring = "Meow,<br>Hello Human.<br>You need to level up to help me.<br>"
}
else if (meetbubbles.pending = false) {
  list remove (pending.list, "Meat Bubbles")
}

The system works and makes for easy quest creation. Often though it doesn't have great flow, and can be hard to tell what to do next. I'm planning on adding a short description of what you need to do next in the Quest Book list as opposed to just a name, but I know it needs more help than that.

I'm mainly wondering if I should just scratch this method(probably my fifth attempt on a quest function) or if I'm on the right track.


Doctor Agon
21 May 2020, 08:21

Take a look, if you haven't already done so, at Pixie's Quest library.
That might give you some ideas.
https://github.com/ThePix/quest/wiki/Library:-Quests


jmnevil54
22 May 2020, 01:02

I have my own simple system.
I have no idea why I'm treating the Quest like an object. ~~~game.quest = 5~~~ works just fine.

Pending = Quest.1 = 5
Unlocked = Quest.1 = 4
In progress = Quest.1 = 3
Completed = Quest.1 = 2
Done = Quest.1 = 1

if Quest.1 = 1
  msg ( "You've completed the tasks." )

Complete a task? Just subtract 1.

Quest.1 = Quest.1 - 1