Using Basic Quest System
I get a lot of questions about this script, so let's get going!
The anatomy of a quest:
A quest is identified by it's unique symbol, which can be any string following a colon and consists of four portions: Details, Descriptions, Objectives, and Rewards.
Since the identifier can be any string, it is really easy to separate quests into easy to remember id's, like: :main_quest001 or :forest_side_quest
Let's get into the nitty gritty of each quest portion.
Details. The detail portion contains the values and options of the quest. The most basic detail set up is:
A full example Details with all options would look something like:
In that example, we now have a quest named Journey Through The Forest, which shows as an "Easy" level 3 quest, which will auto complete when achieved and can not be abandoned.
Descriptions. The Description portion contains all the details of the quest that you want known to the player. The most basic description set up is:
A full example of Descriptions with all options would look something like:
Objectives. The objectives portion is where it gets allll confusing up in here. But it's the most important part. A single objective quest may look like this:
A three objective set up would look something like:
Rewards. The final portion, the rewards portion, determines what the player gets when completing a quest. Just like Description, all values are optional, so a basic set up looks like:
(If we wanted to awards less or more items we would just add or delete entries, a single item reward would look like: :items => [ [:item, 1, 1] ],
And that's all there is to creating a single quest!
Here is the complete full example:
Accepting and Turning In:
Now that the quest is made we just have to incorporate it into the game! Now is where it gets fancy.
Many script calls for flow control are explained in the header of the script, but the most important ones are:
$game_quests[:quest_id].accepted?, $game_quests[:quest_id].completed?, and $game_quests[:quest_id].turned_in?
A simple one-page quest giver would check if their quest has already been turned in (thanks them and tells them to leave then), then check if the quest has been completed (would offer the chance to turn in the quest) then checks if the quest has even been accepted yet (asking for the player to accept if not, asking them why the hell they aren't doing what you told them to do already if they have)
The commands to accept and complete quests are simple: ask_accept(:quest_id) (or accept_quest(:quest_id) to force the quest on the player) and ask_turnin(:quest_id) (or turnin_quest(:quest_id) to force them to turn it in). Since a picture speaks a thousand bananas, or something like that... here's what the simplest setup for quests would look like:
The anatomy of a quest:
A quest is identified by it's unique symbol, which can be any string following a colon and consists of four portions: Details, Descriptions, Objectives, and Rewards.
Since the identifier can be any string, it is really easy to separate quests into easy to remember id's, like: :main_quest001 or :forest_side_quest
Let's get into the nitty gritty of each quest portion.
Details. The detail portion contains the values and options of the quest. The most basic detail set up is:
- DETAILS[:quest_id] = { :name => "Quest name, like 'Journey Through The Forest'" }
A full example Details with all options would look something like:
- DETAILS[:forest_side_quest] = {
- :name => "Journey Through The Forest",
- :level => 3,
- :difficulty => "Easy",
- :auto_complete => true,
- :abandonable => false, }
In that example, we now have a quest named Journey Through The Forest, which shows as an "Easy" level 3 quest, which will auto complete when achieved and can not be abandoned.
Descriptions. The Description portion contains all the details of the quest that you want known to the player. The most basic description set up is:
- DESCRIPTIONS[:quest_id] = {}
A full example of Descriptions with all options would look something like:
- DESCRIPTIONS[:forest_side_quest] = {
- :qgiver_name => "Vlue",
- :location => "Den of the N'yithra",
- :description => "Why don't you go to the forest, and
- get me some berries or something. I'm hungry.
- I might even reward you.", }
Objectives. The objectives portion is where it gets allll confusing up in here. But it's the most important part. A single objective quest may look like this:
- OBJECTIVES[:quest_id] = { :obj_id1 => ["string", id] }
A three objective set up would look something like:
- OBJECTIVES[:forest_side_quest] = {
- :red_berries => ["Collect 3 red berries", 3],
- :blue_berries => ["Harvest 5 bunches of blue berries", 5],
- :smurple_berries => ["Find a rare smurple berry", 1], }
Rewards. The final portion, the rewards portion, determines what the player gets when completing a quest. Just like Description, all values are optional, so a basic set up looks like:
- REWARD[:quest_id] = {}
- REWARDS[:forest_side_quest] = {
- :gold => 100,
- :exp => 50,
- :items => [ [:item, 1, 1], [:weapon, 1, 1], [:armor, 1, 1] ], }
(If we wanted to awards less or more items we would just add or delete entries, a single item reward would look like: :items => [ [:item, 1, 1] ],
And that's all there is to creating a single quest!
Here is the complete full example:
- DETAILS[:forest_side_quest] = {
- :name => "Journey Through The Forest",
- :level => 3,
- :difficulty => "Easy",
- :auto_complete => true,
- :abandonable => false, }
- DESCRIPTIONS[:forest_side_quest] = {
- :qgiver_name => "Vlue",
- :location => "Den of the N'yithra",
- :description => "Why don't you go to the forest, and
- get me some berries or something. I'm hungry.
- I might even reward you.", }
- OBJECTIVES[:forest_side_quest] = {
- :red_berries => ["Collect 3 red berries", 3],
- :blue_berries => ["Harvest 5 bunches of blue berries", 5],
- :smurple_berries => ["Find a rare smurple berry", 1], }
- REWARDS[:forest_side_quest] = {
- :gold => 100,
- :exp => 50,
- :items => [ [:item, 1, 1], [:weapon, 1, 1], [:armor, 1, 1] ], }
Accepting and Turning In:
Now that the quest is made we just have to incorporate it into the game! Now is where it gets fancy.
Many script calls for flow control are explained in the header of the script, but the most important ones are:
$game_quests[:quest_id].accepted?, $game_quests[:quest_id].completed?, and $game_quests[:quest_id].turned_in?
A simple one-page quest giver would check if their quest has already been turned in (thanks them and tells them to leave then), then check if the quest has been completed (would offer the chance to turn in the quest) then checks if the quest has even been accepted yet (asking for the player to accept if not, asking them why the hell they aren't doing what you told them to do already if they have)
The commands to accept and complete quests are simple: ask_accept(:quest_id) (or accept_quest(:quest_id) to force the quest on the player) and ask_turnin(:quest_id) (or turnin_quest(:quest_id) to force them to turn it in). Since a picture speaks a thousand bananas, or something like that... here's what the simplest setup for quests would look like:
Simple! Easy! Kind of! If you need more detail in your quests events you can just expand on this simple set up until you get what you want. Or if you want to get super fancy, I'd recommend looking into using Script Page Event Conditions and combining that with this! It's quite versatile!
Advancing and Setting Objectives:
I can't help but feel like I'm forgetting something... Ah, I know! How do you advance the objectives so you can actually complete quests!? Yah, that would be nice to know, very important! It's simple (which means it's not). I've made easy enough functions that you can call to achieve the results, and they are:
adv_obj(:questid, :objid, value), set_obj(:questid, :objid, value), and obj(:questid, :objid). Using the sample quest from above, setting the first objective (red_berries) to 1 and adding 2 to the second objective (blue_berries) would look like this:
set_obj(:forest_side_quest, :red_berries, 1)
adv_obj(:forest_side_quest, :blue_berries, 2)
Where do we get these numbers tho? What kind of sorcery can we use to make sure objectives are being tallied correctly!? Well, I'll go over some of the more obvious options:
For items you have two options, if the item is gained via an event you can just call adv_obj(:questid, :objid, 1) every time you add the item. But if it's added other ways, like by enemy drops or shop buying, you'll have to get creative. The best method, a parallel process event that constantly updated the objective to the amount of item in the inventory. A script call like that would look like (assuming red berries are item #1):
set_obj(:forest_side_quest, :red_berries, $game_party.item_number($data_items[1]) )
It's a little big, but it works!
For monsters you have... a few options. If you do it by monster groups and all battles are evented, then it's real easy! Just adv_obj after each battle. But if you don't have that kind of set up, then you'll probably have to find some sort of script that allows you to call events after a battle is over! Like this one: After Battle Events
Then you can set up a event to run after a battle that utilizes adv_obj to advance monster based objectives.
Any other sort of objective you'll have to set up yourself using the set_obj and adv_obj commands as they pop up! It's easy when you get the hang of it! (Pretty much any other sort of objective type would be found during evented scenes and events anyways, so just toss them in there)
And that's it! Now you should maybe, hopefully, probably know how to set up a quest, accept, complete, and turn it in, and advance it's objectives! What fun!
For a project demonstrating a couple of fully functional events, click this button.
Advancing and Setting Objectives:
I can't help but feel like I'm forgetting something... Ah, I know! How do you advance the objectives so you can actually complete quests!? Yah, that would be nice to know, very important! It's simple (which means it's not). I've made easy enough functions that you can call to achieve the results, and they are:
adv_obj(:questid, :objid, value), set_obj(:questid, :objid, value), and obj(:questid, :objid). Using the sample quest from above, setting the first objective (red_berries) to 1 and adding 2 to the second objective (blue_berries) would look like this:
set_obj(:forest_side_quest, :red_berries, 1)
adv_obj(:forest_side_quest, :blue_berries, 2)
Where do we get these numbers tho? What kind of sorcery can we use to make sure objectives are being tallied correctly!? Well, I'll go over some of the more obvious options:
For items you have two options, if the item is gained via an event you can just call adv_obj(:questid, :objid, 1) every time you add the item. But if it's added other ways, like by enemy drops or shop buying, you'll have to get creative. The best method, a parallel process event that constantly updated the objective to the amount of item in the inventory. A script call like that would look like (assuming red berries are item #1):
set_obj(:forest_side_quest, :red_berries, $game_party.item_number($data_items[1]) )
It's a little big, but it works!
For monsters you have... a few options. If you do it by monster groups and all battles are evented, then it's real easy! Just adv_obj after each battle. But if you don't have that kind of set up, then you'll probably have to find some sort of script that allows you to call events after a battle is over! Like this one: After Battle Events
Then you can set up a event to run after a battle that utilizes adv_obj to advance monster based objectives.
Any other sort of objective you'll have to set up yourself using the set_obj and adv_obj commands as they pop up! It's easy when you get the hang of it! (Pretty much any other sort of objective type would be found during evented scenes and events anyways, so just toss them in there)
And that's it! Now you should maybe, hopefully, probably know how to set up a quest, accept, complete, and turn it in, and advance it's objectives! What fun!
For a project demonstrating a couple of fully functional events, click this button.