Difference between revisions of "A First Look, Part 1"

From RPG Creation Kit
Jump to navigation Jump to search
Line 116: Line 116:
The ''Conditions Node'' has two ends, "Result True" and "Result False" which will redirect the dialogue in base of the result of the processing of the conditions. If the player picked up the note and never went further than Stage 10, the dialogue will continue on the "Result True" end, otherwise the dialogue will continue on the "Result False" end.
The ''Conditions Node'' has two ends, "Result True" and "Result False" which will redirect the dialogue in base of the result of the processing of the conditions. If the player picked up the note and never went further than Stage 10, the dialogue will continue on the "Result True" end, otherwise the dialogue will continue on the "Result False" end.


At both ends you'll find a ''Player Questions'' node, with the questions the player can ask. The response to each question will redirect the dialogue to the connected node.
At both ends you'll find a ''Player Questions'' node, with the questions the player can ask. The response to each question will redirect the dialogue to the connected node. The two ''Player Question'' nodes are almost identical, but one of them, the one that plays if the Conditions are met has an extra question that says "About that note on the board...", while the others all redirects to the same ''NPC Dialogue Lines''.
 
And that's pretty much it, notice how the dialogue flows in the other cases (when the other questions are asked) and you will find the remeaning '''3.''' and '''4'''. points of our dialogue.
 
To progress with the quest, we need to ask "About that note on the board..." that will trigger a sequence on ''NPC Dialogue Lines'' where the last one will have some special settings that will allow the quest to proceed.
[[File:Afl 2.png|thumb|312x312px|The last ''NPC Dialogue Line'' of Mother Nebivia dialogue, this is the line that will make the quest progress from Stage 10 to Stage 20.]]
Let's analyze the last ''NPC Dialogue Line''.
 
Click on Show/Hide to unveal hidden properties and settings, we are interested in the '''[[Events And Consequences|Events]]''' this node will execute. Events and Consequences are shortcuts that you will use to make things happen inside the game. They can partially replace the needing of using Scripting, indeed, we could have started the quest with Events in the first place instead of using the Item Script, but for the sake of learning and because I think it's more well-organized this way, I've used Scripting.
 
'''Events''' helps you do 3 fundamentals things:
 
* '''Quest Dealers:''' adds new quests.
* '''Quest Updaters:''' sets new stages and completes existing ones.
* '''Consequences:''' applies various consequences.
 
 
We need to progress with the quest, so we obviously need to use Quest Updaters.
 
We'll use two, one for completing the Stage 10 and another one to setting the Stage to 20.
 
With this we are done with this Stage, as soon as the NPC will speak this line the Quest will progress, the Current Quest Stage will be 20, the dialogue will end (because of the After Line) and the player will be able to progress with the quest.
 
Notice that if you speak to Mother Nebivia again, the ''Condition Nodes'' will always return false, because the Current Quest Stage is 20, so it's greater than 10 and it doesn't match the conditions we've set anymore, neither it will ever do again.

Revision as of 20:58, 13 February 2022

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 most of 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 it is a way to make things works and progress and 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 at the entrance the Item In World of the note we've analyzed before.

The AI Actor of Mother Nebivia outside the Curch in the cell "Virrihael(2,2)".

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.

We want to analyze her Current Dialogue Graph, which is the Dialogue that will run when the player speaks to her. Double click on the Current Dialogue Graph reference, and the Dialogue will open in the Node-Editor Window.


From there, I suggest you read the Dialogue page before proceeding and get a rough idea on how dialogues are made and which are their components.


Before analyzing it, let's say what we want and how talking to Mother Nebivia should work:

  1. Mother Nebivia greets the player with a random greet phrase.
  2. The Player is prompted to ask or say something. If he is in Stage 10 with the quest "Every Dead Man's Nightmare", he should be able to ask for more information about the Thief. Otherwise if he didn't picked up the note, that dialogue option should not appear.
  3. The player can ask about the Church.
  4. The player can leave the conversation.


The first thing that you should notice in the dialogue is the Entry Node, this is where every Dialogue starts.

To achieve the point 1. of our dialogue, we use a Random Node, which will select a random end point between the list and redirect the dialogue to one of the three NPC Dialogue Lines, that will allow Mother Nebivia to greet us.

The point 2. has been explained with a condition, in fact, we said that we only want to be able to ask about the Thief if the Current Quest Stage is 10. To achieve that we need to use a Conditions Node, where the conditions are:

  • Stage of the quest "Every Dead Man's Nightmare" > 0 (means the quest has started).
  • Stage of the quest "Every Dead Man's Nightmare" <= 10 (means we never went further of Stage 10).

If you click on the "Configure Conditions" button in the Conditions Node, you will see the exactly same conditions implemented inside the window.

The Conditions Node has two ends, "Result True" and "Result False" which will redirect the dialogue in base of the result of the processing of the conditions. If the player picked up the note and never went further than Stage 10, the dialogue will continue on the "Result True" end, otherwise the dialogue will continue on the "Result False" end.

At both ends you'll find a Player Questions node, with the questions the player can ask. The response to each question will redirect the dialogue to the connected node. The two Player Question nodes are almost identical, but one of them, the one that plays if the Conditions are met has an extra question that says "About that note on the board...", while the others all redirects to the same NPC Dialogue Lines.

And that's pretty much it, notice how the dialogue flows in the other cases (when the other questions are asked) and you will find the remeaning 3. and 4. points of our dialogue.

To progress with the quest, we need to ask "About that note on the board..." that will trigger a sequence on NPC Dialogue Lines where the last one will have some special settings that will allow the quest to proceed.

The last NPC Dialogue Line of Mother Nebivia dialogue, this is the line that will make the quest progress from Stage 10 to Stage 20.

Let's analyze the last NPC Dialogue Line.

Click on Show/Hide to unveal hidden properties and settings, we are interested in the Events this node will execute. Events and Consequences are shortcuts that you will use to make things happen inside the game. They can partially replace the needing of using Scripting, indeed, we could have started the quest with Events in the first place instead of using the Item Script, but for the sake of learning and because I think it's more well-organized this way, I've used Scripting.

Events helps you do 3 fundamentals things:

  • Quest Dealers: adds new quests.
  • Quest Updaters: sets new stages and completes existing ones.
  • Consequences: applies various consequences.


We need to progress with the quest, so we obviously need to use Quest Updaters.

We'll use two, one for completing the Stage 10 and another one to setting the Stage to 20.

With this we are done with this Stage, as soon as the NPC will speak this line the Quest will progress, the Current Quest Stage will be 20, the dialogue will end (because of the After Line) and the player will be able to progress with the quest.

Notice that if you speak to Mother Nebivia again, the Condition Nodes will always return false, because the Current Quest Stage is 20, so it's greater than 10 and it doesn't match the conditions we've set anymore, neither it will ever do again.