Cereal's Quest System

I’ve been sitting on this package for just over a year now, and to be honest it’s more of an achievements package than a quest package, but I’m not going through all my games and renaming the script, so here we are.

If you’re looking for a traditional quest package with a UI showing your current objectives and whatnot, check out Slater’s Advanced Quest System - Package Guides - Crayta

You probably want a UI for this package, in which case check out cMenu - Quests

Installation

  • Install the Quest System package
  • Drag the User Quests template on to your User template
  • If you don’t have the Document Stores package setup yet, drag the Document Stores template onto the user
  • Drag the Quest System Store onto the Document Stores folder

Usage

Now the fun part.
Each quest is comprised of many quests. Each of those quests can, in turn, be comprised of many quests.

Create script folders containing a questScript for each quest you make. For example, let’s say you’re making a quest to find all the presents in Whoville.

Your structure might look something like this:

image

Each child of the Quests folder contains as questScript.

Whoville:

Presents:

Library:

As you can see, the essentials to a quest are simple an ID, the parent’s ID (if it has a parent), and the name.

To complete a quest is quite simple. All you need to do is call the Complete method on the questScript.

Consider needing to interact with a present to complete the library quest. You can write a script like so

local PresentQuestCompletionScript = {}

PresentQuestCompletionScript.Properties = {
  { name = "questToComplete", type = "string" },
}

function PresentQuestCompletionScript:OnInteract(player)
  local user = player:GetUser()
  user.userQuestsScript:CompleteQuest(self.properties.id)
end

return PresentQuestCompletionScript

Adding this to an entity in your world and setting the quest ID will cause the quest to complete on interact.

Additional Features

This quest system additional tracks a score per quest completed. Simply set the score property of a quest to a non-zero value.

We also integrate with a leaderboard called quest-system, simply add a leaderboard to your game with this ID to use it.

In addition, the XPEvent “quest-system-progress” is sent whenever a quest is progressed. That includes completing a quest, and simply making progress towards the completion of a quest.

1 Like
  • Added onQuestComplete event to userQuestsScript
  • Added onQuestProgress event to userQuestsScript
  • Added onProgress event to questScript
  • Added Progress() method to questScript, which returns a value between 0 and 1 dictating how far along the quest is.
  • Added a trackByDefault property
  • if cMenu - Notifications is installed, Quest System will now use it to display quest completion notifications. Still uses the default Notification package if not
  • Added a IsQuestCompleteForDialog method for use with Adam’s Dialog package. Specify IsQuestCompleteForDialog in the queryFunction, with an string argument type, and put the quest ID in the stringArg property.
  • Fixed an issue where calling a method before the quest system was initialized could throw an error.