A First Look, Part 1
In this tutorial we will deeply examine a quest from the Demo, which is "Every Dead Man's Nightmare", if you have not played this quest, do it before proceeding with the tutorial. This is a long article where most of the elements of the RCK are used and explained, or at least mentioned, so make sure you have plenty of time before going forward.
The Quest goes this way:
The Player arrives to the North-East village and notices a board with some notes hanged on it. He gets near and examine them, the note is written by "Mother Nebivia", the priestess who runs the Curch, apparently there is a man who is digging graves and stealing the goods buried with the dead people at the cementary. The Player picks up the note, and the Quest starts. The first objective is to speak to Mother Nebivia, which will give the Player more details about what is going on, then the Player is sent to check the cementary.
When he arrives, he will see the Thief digging a grave. When the player will get closer, the thief will stop digging and talk to the player. Here the player can decide what to do, the quest can end in three ways:
- The player accepts a bribe form the Thief.
- The player kills the Thief.
- The player convinces the Thief to stop doing what he's doing.
If the Player accepts the bribe, the quest ends straight away.
If the player kills or convince the thief to go away, he will have to report the news to Mother Nebivia, that will give him a reward and end the quest.
This quest utilizes almost all the features that the RCK has to offer, that is why I've picked it as the quest to deeply analyze, because if you understand how is it made, you'll understand how the RPG Creation Kit really works and how every other quests in the Demo are made.
The Quest "Every Dead Man's Nightmare" has the ID: "SQ_EveryDeadMansNightmare" and is accessible to be viewed from the Rck Object Viewer.
Make sure to follow those two links to learn what a Quest is, how is it composed and how to open a quest with the Quest Editor before proceeding.
Starting the Quest
At this point the Current Stage of the quest is 0, since the quest never started.
The way the quest starts for the Player, as we said, is by picking up a note from the board. This note is a Book Item, a type of Item that represents a Book or a Note readable by the Player. What the Player sees on the board, is the Item In World of the "QI_NoteLookingForWork001" item, accessible from the Rck Object Viewer.
Open up the "QI_NoteLookingForWork001" in the Item Editor and you will notice few things:
- The Book Text says exactly what is displayed in game.
- You'll see the 3D model of the Item In World.
- You'll notice that it has an Item Script assigned.
Out of every settings, the only one that could add the quest is obviously the Item Script.
Now, if you're not a programmer and you don't know how to code, don't worry, you're totally fine. Indeed, what happens here fundamentally is Scripting. You will not have to learn how to code, but you'll just have to use pre-made functions. Knowing how Scripting works is important, as some things can be done only through Scripting. I'll make sure to explain it as the best as I can.
The Item Script is a piece of code that runs when certain events regarding items occurs, such as when the Item is added into an inventory, or when the Item is equipped, dropped, took or deposited from/in a Looting Point.
Which is exactly what we are looking for, as we know that we want to start the Quest as soon as the note is added in the Player Inventory.
Look up for the Item Script "HangingNote001ItemScript" inside the project and open it into Visual Studio, or whatever editor you've installed:
public class HangingNote001ItemScript : ItemScript { public override void OnAdd(Inventory inventory) { base.OnAdd(inventory); if(inventory == Inventory.PlayerInventory && RCKFunctions.GetStage("SQ_EveryDeadMansNightmare") == 0) RCKFunctions.AddQuest("SQ_EveryDeadMansNightmare"); } }
Don't you dare getting scared, this code is actually very slim and simple.
Whenever you see "public override" it means that we are defining the behaviour of what needs to occur upon a certain action, this action is written at the immediate right, in this case it's the "OnAdd". The "inventory" represents the Inventory that just received this Item.
Let's look at the content of the function, you can ignore the base.OnAdd(inventory); and focus on what is written below, the two lines that interests us.
The first one is a condition:
if(inventory == Inventory.PlayerInventory && RCKFunctions.GetStage("SQ_EveryDeadMansNightmare") == 0)
Means "if the inventory that received this item is the inventory of the player (so if it was the player receiving the item) AND at the same time (&&) the current stage of the quest with ID 'SQ_EveryDeadMansNightmare' is equal to 0 (means the quest didn't started yet, nor it was ever completed)" execute the line below:
RCKFunctions.AddQuest("SQ_EveryDeadMansNightmare");
That means: "Add the quest with the ID 'SQ_EveryDeadMansNightmare'".
And with just that we're done, as soon as the player will pickup the note, the quest will start, the interface will be updated, as well the journal. The Current Stage of the quest will have the value of 10 and the Player will be able to continue with the quest.
If you're wondering what RCKFunctions is, it's just a static class that contains a lot of pre-made functions just as these two we've seen above (GetStage and AddQuest), we'll get to it later, you will use it a lot.
Stage 10
The Stage 10, if opened and viewed in the Quest Editor, does not have any particular setting, but the description "Speak to Mother Nebivia at the Curch".
We can easily deduce that to progress with this quest, we will need to make use of Dialogues.
Before going forward, focus on the Cell View, select as the Worldspace "Virrihael" and open the cell with ID "Virrihael(2,2)" by double clicking on the corresponding button. You will see in the Scene View that you are in the village, move around and notice on the board the Item In World of the note we've analyzed before.
Now move near the Curch and you will notice that Mother Nebivia is placed there.
Actually, an instance of her is placed there, because every AI Actor has a corresponding prefab that lives inside the project, however, the same AI Actor prefab should be only placed in the world or instantiated once.
Click on her and take a look at the Inspector, focus on the "Rck AI" component. For the Stage 10, we are interested in her dialogue components, so click on the "Dialogue" tab and the Inspector will show all the relevant dialogue's information.