Friday Script – Quest Journal!

If you want to get the most out of RPG Maker, learn Ruby. In the meantime, lots of talented scripters have done the work for you. Every Friday, The Iron Shoe features a fun script and goes into detail about how to use it. It also covers a little bit of Ruby each time so you can make even more out of the script.

Gone are the days of the Super Nintendo, where players were just expected to remember the objective and the myriad side quests in a game. We no longer put our players through that torture. Instead, we help them along with objective markers, glowing items, and of course – quest logs! This Friday let’s explore Modern Algebra’s Quest Journal.

Add it to your scripts list and away we goo!

Making Quests

Before really digging into activating, deactivating, and all that jazz, we’re first going to have to make a quest. This is done in the body of Modern Algebra’s script, but don’t get scared! Basically no coding knowledge is required. First off, look for the following around line 760:

Quest Journal

Add your quests after the green text – the “comments.” That green text shows you the format of how to set all of the attributes of your quest.

Here’s where you’ll enter all of the information for all of your quests. Quests in this script can have the following:

  • Name – be it punny or direct, a good quest always starts with a good name
  • Icon – choose anything from your current item/armor icon set to display next to your quest. A scroll, a shield, you name it.
  • Level – sometimes a player gets a quest to kill the level 18 Ice Wolf when they’re level 2. Let your player know that they should hold off a bit.
  • Description – a little bit of flavor text goes a long way in explaining the quest.
  • Banner – an extra to use as the header for your quest journal; maybe you’ve got a fancy graphic for each one!
  • Objectives – the nuts and bolts of a quest. Go here, do this, kill him, come back, tell everyone.
  • Categories – some quests are Main, some are Side, some are Culinary and some are In Town. Make your own categories and go wild.
  • Client – who issued the quest?
  • Location – where the f do I do this quest?
  • Rewards – the only reason you’re doing the quest

You don’t have to use all of these, but you can! Modern Algebra has provided a delightful sample quest so you can see how to make your quest. For each one, you’ll need to type “when N” but replace the N with a unique, sequential number. After that, setup any and all quests you’d like.

Quest Journal

In Vidar, each quest’s fail condition is also an objective – and it’s listed in the prime objectives. If your quest giver dies, the quest is auto-failed.

 

A note about objectives and prime objectives. They’re the meat of your quest. As with quests, within a quest each objective must be unique and sequential. They’ll show up in the order you add them, so consider game progression as well. Prime objectives are just a critical list of objectives. If any one of the objectives listed in prime objectives is failed, the quest will automatically fail. If all of them are complete, the quest will be marked complete.

Wait, this fails quests? I thought it was just a log! By fail or complete quest, we’re talking changing the font to red or green, respectively, so that the player knows there’s been a change. Additionally, the quest will move to a separate menu so that the player isn’t haunted by their failure for 20 more hours of gameplay.

Updating Quests

This log ain’t gon’ run itself, child. Every time you want to update a quest, you’ll need a script call in your event. You’ve got a few options, all listed at the top of the script. Let’s talk about some:

  • reveal_objective(quest_id, objective_id) – reveals an objective. A few notes. (1) if the quest isn’t revealed, it’ll reveal that too. (2) “quest_id” refers to the “N” in “when N” discussed above. That “N” is that quest’s unique ID, so use it in place of “quest_id” in your script call. (3) Same goes for objective_id!
  • complete_objective(quest_id, objective_id) or fail_objective(quest_id, objective_id) – betting odds you can figure this one out on your own.
  • reset_quest(quest_id) – got a quest where it’s an all or nothing, but you can try multiple times? Just call reset_quest on it in your script call.
  • manually_complete_quest(quest_id) – sometimes relying on the prime objectives system won’t cut it, and that’s just fine. You can complete and fail quests by hand.

So how might we call one of these scripts?

At a time where his neighbors, friends, and family are dying around him, Robert just really needs that flower.

At a time when his neighbors, friends, and family are dying around him, Robert just really needs that flower.

Checking Quests

You can also use objectives and quests to control events. While “event flow” is typically handled with switches, organizing them can be a mess. And if you’re just going to have a switch that is “quest 2 objective 0 complete” – why bother? The script will handle it for you!

Non-scripters may have missed a wonderful little built-in for the conditional branch – a script call. That’s right, your conditional branch can do a script call all on its own. Check it out!

There! Any script that evaluates to "true" or "false" can be put in that little line!

There! Any script that evaluates to “true” or “false” can be put in that little line!

With our new fancy-pants journal, in that box we can add the line

objective_complete?(2,0) 

and it’s the same as saying “if switch ‘quest 2, objective 0 complete’ is on”. How nifty!

Digging Deeper With Ruby

As you might imagine, we can have some great fun with these quests well beyond what Modern Algebra has set up for us. Truly the sky is the limit. Take the following example.

Piper has asked Peter Player to pack a peck of peppered pickles, but he’ll have to pick them from a pickle tree first. Piper estimates that a peck could hold ten pickles, so he’s asked Peter to go into the pickle forest and pick 10 pickles.

You can imagine how to set up a quest like this, with 10 pickle events throughout the forest. When you interact with them, you get a pickle, and when you talk to Paul with 10 in your inventory, you’ll get your reward. An easy way to give the player an objective in Modern Algebra’s quest log is “Pick 10 pickles.” But let’s do one better and say “Pick X pickles” where X is the number of pickles remaining. Let’s also add another objective, shown to the player only when he succeeds in picking all 10 pickles – something like “Return to Piper to peck your pickles.”

Dynamically changing the text of a quest in the quest log is easy. Let’s track our pickles with a variable, let’s say Variable 2, we’ll call it “Pickles Remaining”. When you receive the quest, set Variable 2 to 10, like so:

Piper seriously cannot get enough pickles - peppered or not.

Piper seriously cannot get enough pickles – peppered or not.

Then for each pickle, reduce the variable by 1. But we want this information quickly reflected in the quest log as well. Not to fear! Using \\V[2] in the quest objective, we can display the value of Pickles Remaining right in the objective! (remember to use two slashes here, not one).

Using \\V[2], we can access the variable Piper just created for us.

Using \\V[2], we can access the variable Piper just created for us.

On picking up a pickle, ask whether Variable 2 is equal to 0. If it is, complete that objective, and move onto the next objective, like so:

The RPG Maker resource pack doesn't come with a pickle. Someone alert Enterbrain of this egregious bug in their program immediately.

The RPG Maker resource pack doesn’t come with a pickle. Someone alert Enterbrain of this egregious bug in their program immediately.

Beginner Challenge

When Peter Player arrives at the pickle forest, he finds a sentient pickle tree that offers him a deal. Pick no pickles, and take instead 10 rotten pickles back to Piper. Tell her they are freshly picked and she’ll get sick, but it will save the pickle tree’s pickles. How might you change the description of Objective[0] in our quest log to reflect this new option and change in circumstance?

Advanced Challenge

Piper’s penchant for pickles is insatiable. While she’ll give you a potion for 10 pickles, the rewards will be much better for 20, 30, or even 40 pickles. How might we display all of the possibilities in the Quest Log?

Check back in 2 weeks for the answers to both challenges!

Advertisements

One thought on “Friday Script – Quest Journal!

  1. Pingback: Modern Algebra’s Quest Journal Revisited – Challenge Solutions | The Iron Shoe

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s