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.
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:
Each child of the Quests folder contains as questScript.
Whoville:
image 377×612 37.4 KB
Presents:
image 382×607 39.5 KB
Library:
image 380×603 40.2 KB
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" },
}
functionPresentQuestCompletionScript:OnInteract(player)
local user = player:GetUser()
user.userQuestsScript:CompleteQuest(self.properties.id)
endreturn 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.