Quest and Dialogue Tutorial

From GECK
Jump to: navigation, search
This article is incomplete. You can help by filling in any blank descriptions.
Further information might be found in a section of the discussion page. Please remove this message when no longer necessary.


Prelude

Quests are everywhere in the game. Some are the "real" ones, full of dialogues, stages, objectives etc. - these are common quests, that Player accomplish while playing the game. Some quests however can be hidden to Player, and used only to run scripts to check something or set some events. They are also used for dialogues between Player and NPC, as well as between two or more NPCs or even monologues, ot even as a radio stations.


In this tutorial we will build a quest with a simple story. We will go through:

  • designing a simple quest,
  • setting quest objects in the world,
  • editing quest data and objectives,
  • adding quest targets,
  • implementation of a dialogue.

There is only one requirement – you must be familiar with GECK environment. If you do or if you went through My First Vault tutorial, then we can start.


Writing the story

For this tutorial the story is a very short one:

In Megaton Clinic there is a girl, Amanda, who lived in Springvale School some time ago. When she was escaping from there, she lost her friend, a teddy bear. Now she is waiting for someone who will find this toy for her. In return she can teach how to summon a bear (perk).

I have also prepared first version of the dialog between Amanda and Player:

  • 1. GREETING
    NPC: Can I ask you a question?

Standard greeting, only for first dialog between Amanda and Player. As you can see, I am already using topic IDs, that will be assigned to topics in the GECK. For this topic there is only NPC response.

  • 2. aBHTopicWelcome
    PC: Hello young lady. What can I do for you?
    NPC: Could you find my teddy bear please?
    I lost him while I was escaping with my mother, in Springvale School.
    He was my friend... Find him please... (Continue with PC choice, 3.1-3.5)

This is PC choice dialog and NPC response, also only for the first dialog between Amanda and Player. It will be followed by PC choices from 3.1 to 3.5, according to different conditions. This topic should be said only once in the game.

  • 3.1 aBHTopicAgreeWithChallenge
    PC: [check if player has a "children perk" and speech challenge, average difficulty] Maybe I will give you another teddy bear, what you say, eh?
    I. NPC: (success) OK, I will be waiting for him, thanks. (Goodbye)
    II. NPC: (failure) No, he is my friend, a special one. (Return to dialog)

This choice will show up in the dialog menu only if Player has a children perk, actually – the ChildAtHeart perk. I want it also to be a challenge topic, with average difficulty. In case of failure it will need a special topic, but we will take care of it later on.

  • 3.2 aBHTopicAgree
    PC: OK, I will bring it for you.
    NPC: Thank you. I will be waiting for your return. (Goodbye)

  • 3.3 aBHTopicDisagree
    PC: What? I have better things to do. Get lost.
    NPC: I don't like you. (Goodbye)

  • 3.4 aBHTopicHaveTeadyBear
    PC: Yes, I have found a toy with your name on it. Here it is.
    NPC: Thank you.
    As a reward I will teach you how to summon a friend, a bear, so you will never be alone anymore. (Goodbye and the end of the Quest)

The 3.4 choice will be available if Player already has a teddy bear for Amanda, before speaking with her for the first time.

  • 3.5 aBHTopicByeBye
    PC: I must go now.
    NPC: Bye bye. (Goodbye)


All set up. So how it will look like in the game, when Player begins first talk with Amanda? First Amanda will say the #1 topic, the GREETING:

  • NPC says: Can you help me?

We will talk about greetings and goodbyes later; for now lets simulate the dialog. After the greeting from Amanda, the dialog menu will open. This is the first talk between Amanda and Player, so Player will have only one choice of a dialog, topic #2:

  • Player says: Hello young lady. What can I do for you?

After Player clicks on this topic in the dialog menu, he or she will get a NPC response:

  • NPC says: Could you find my teddy bear please?
  • NPC continues: I lost him while I was escaping with my mother, in Springvale School.
  • NPC continues: He was my friend... Find him please...

After this there will a couple of topics, #3.1 - #3.5, according to different conditions. Assuming this is the first talk and player do not have a teddy bear yet, then available choices will be all #3, excluding #3.4.


I hope that now you have a picture about what we are doing, so lets continue to the second talk.

  • 4. GREETING
    NPC: Do you have a teddy bear for me?

  • (3.4) aBHTopicHaveTeadyBear
    (player has a teddy bear, so the topic is the same as #3.4)

  • (3.2) aBHTopicAgree
    (player wants to start the quest, so the topic is the same as #3.2)

  • (3.3) aBHTopicDisagree
    (player disagree on the quest, so the topic is the same as #3.3)

  • 4.1 aBHTopicNotYet
    PC: No, not yet.
    NPC: So please hurry. He is the dearest friend of mine. (Goodbye)

  • (3.5) aBHTopicByeBye
    (Bye stays the same)


Why there is an aBHTopicAgree topic? Because this is the second talk and in the first one, that was displayed in the game only once, Player could disagree on the quest. So Player should have another option to start the quest. In the second talk there are many conditions – the time is short, so we will talk about them later, while building the dialog in the GECK.


Preparing the environment

Basically I need two objects: NPC-Amanda and an item – Teddy Bear. In game there are already two objects that I can use. In object window, in Actors->NPC node I have found Flower, a girl that is similar to my Amanda, and in Items->Misc Item->Clutter there is TeddyBear01 object.


NPC Amanda – essential actor

Let's double click on NPC-Flower and create a new base object.

  • ID: aBHAmandaFlower
  • Name: Amanda
  • Essential: Yes (checked)


The Essential box is checked, because I don't want Amanda to die before the quest is over. I don't modify any data in Traits nor in Stats tabs, but in Factions there is RepublicOfDaveFaction. Amanda has nothing to do with them, so I delete this entry and add a new one. She will be placed in Megaton Clinic, so I am adding a MegatonClinicFaction (rank=0). This change is important for a new NPC added to specific environment. I will not talk on this topic now, but you can go to menu Character->Faction and see that some factions do not like each other. If in the same cell there are two actors of two enemy factions, they will start to fight. So even if Amanda has a good alignment (set up in the Traits tab), it is better to change her faction to a proper one, suitable for her environment and of course for the quest.

In AI Data Tab:

  • Aggression: Unaggressive
  • Confidence: Cowardly
  • Assistance: Helps Nobody
  • Mood: Pleasant
  • Energy: 50
  • Responsibility: 50


In AI Packages Tab I delete all entries – if I hadn't done it, Amanda would go away to some mysterious cell and it wouldn't be possible to find her in Megaton Clinic. Now right click on the list of packages and add a New package.

  • ID: aBHStandardWander
  • Package Type: Wander
  • Wander location: Near editor location
  • Radius: 50
  • Allowed behavior: (all)

"Near editor location" means, that in her common behavior Amanda will stay at place, in a cell where she was added in the GECK.


In the Flags tab I only set the Enable Fallout Behavior flag – with this she will behave like a common villager: she will talk with other NPCs, run away if there is fight etc.

  • Schedule: any time
  • Duration: 0

This means the AI package will be active all the time.

If you are doing this test plugin with me, instead of Wander, you can use Sandbox Package. Again, I will not go now into AI packages, because for this tutorial I need only standard NPC behavior.


That’s all for AI. In inventory I found RDGateKey – delete it. KIDOutfitWastelandChild04 is a standard suit for children, so I leave it. Other tabs in NPC properties I leave untouched. However, if you wish, you can play with Amanda's appearance (go here for more info about NPC).


Teddy Bear – quest item

In Object Window I go to Items->Misc Item->Clutter list and search for TeddyBear01. I want to use this object, its .nif model and .dds inventory icon files, as Amanda's teddy bear. So I double click on TeddyBear01 to edit its properties.

  • new ID: aBHTeddyBear
  • new Name: Amanda's Teddy Bear
  • new Weight: 0.0000
  • new Value: 100
  • Quest item: yes (box checked)


After these modifications I click on the OK button. Editor asks if I want to create a new form – yes, this is what I want, so my answer is Yes.

This object is flagged as a Quest Item, and if Player takes it, he/she will not be able to remove it from the inventory. That is why quest objects usually have a Weight of 0.0000. Teddy Bear will be removed by result script, that we will set up at the end of tutorial.


Adding objects to the world cells

I have objects, so it's time to add them to the world.

Amanda will be in Megaton Clinic. In the Cell View window I search for MegatonClinic and double click on it. While uploading the objects, I got one warning message, something about missing .dds texture – it is not important, because I'm using original objects and I'm sure they are good. After all objects of this cell are uploaded, in render window I can see a clinic. I double click on some object on MegatonClinic object list and press the T key to have a top view. Now I'm searching for some space, where I can put aBHAmandaFlower NPC object. It is too dark in the Render Window, so press the A key to enable editor's bright light. OK, I found a place, so now drag and drop NPC into it.


Now the most important thing. When Amanda is placed in the cell, I double click on her to open a properties window of this reference. Please note, that objects in the Render Window actually are not objects, but references to base objects. In the Reference window I do two things:

  1. check if Persistent Reference box is ticked – it should be, as for any other NPC,
  2. put a new name of the Reference Editor ID – I enter aBHAmandaFlowerREF. Note that base object for Amanda is aBHAmandaFlower. It is a standard procedure of naming the references: just add a "REF" appendix to the object's name. And it is very important, because later I will be using this NPC reference many times while checking some conditions (e.g. as a Quest Target) or maybe even in scripts.


Teddy bear will be placed in SpringvaleSchool01 cell. This is the first, main floor of the Springvale School. I do the same as I did with Amanda:

  1. check if Persistent Reference box is ticked – it is not, so tick it;
  2. put a new name of the Reference Editor ID – I enter aBHTeddyBearREF. Actually it is not necessary in this case, because I'm sure it won't be used in any scripts nor conditions.


I think everything is ready to start a quest building now.


New quest

In the Object Window I go to Actor Data->Quest, right click on the list and add New. The Quest Window will open, with empty fields in Quest Data Tab. Time to fill them in.


Quest Data

  • Quest Name: Bear Hunting
  • ID: aBHQuest
  • Priority: 55
  • Start game enabled: Yes (tick the checkbox)
  • Script processing delay: Default (tick the checkbox)

Important! After filling in those fields, click on the OK button in the bottom right side of the Quest Window. This will save the quest data. Then you can open the quest window again and proceed with quest creation.

Quest Name is what Player will see in the quest journal, on the list of quests.

Priority of 55 is between Miscellaneous (50) and Main (60) quests, so it should be enough to start in the game. Actually in this case it is not important what value of the priority I will put, because I am creating an autonomic, totally custom quest. However, to be sure it will show up in the game, I enter the priority of 55.

If a quest is Start game enabled, then it is active right from the start of the game, new game or loaded save game that doesn't contain any data of my custom plugin. Active or Enabled means, that all conditions from scripts or conditions' fields, related to this quest, are processed by the game. So if there are many conditions or scripts that use many arithmetic functions in conditions, it is better to find some other way and do not enable a quest from the game start, leave this field blank and activate the quest with StartQuest, SetStage or SetObjectiveDisplayed script functions.

With Script processing delay box checked the quest scripts processing, by default, will be delayed by 5 seconds of the real time.

More information about quest data tab can be found here.


Quest Objectives

I have prepared the following list of quest objectives:

Index Display text
0
5 I have found a very strange teddy bear. I should keep it, maybe it would be useful in the future.
10 Go to Springvale School and search for Amanda's toy.
20 Search for Amanda's teddy bear somewhere inside the building.
30 Go to the Clinic in Megaton and give to Amanda her teddy bear.
50 Find or buy a teddy bear for Amanda, a girl from the Clinic in Megaton.
200 Amanda received her toy and in return she has shown me how to summon a bear.


You can add to your quest something similar, if you wish. It is performed by right clicking on the list of objectives and choosing New. Set up quest index in the Index field and enter text in the Display Text field. Maybe index #0 is not necessary, but many vanilla quests have it, so I am using it too.

While creating a new quest remember to use indices x10, i.e. 10, 20, 30 etc. Why? Because later it may arise a problem, when it would be necessary to add some new quest objectives between the existing ones. Take a look at my list again – did you noticed, that there is no #40 between #30 and #50? Well, it was, but I moved it to index #5. And I was able to do it, because I started my quest objectives with index #10.

Minimum objective index is 0 and maximum is 255.

How to add new quest objectives? Just right click on the list and choose "New". In Quest Objective Data options, in the Index field put the index number and in Display Text enter the text that will be displayed to the player.

What is the order of objectives in my quest? I made an assumption, that there are three paths for Player to accomplish the quest:


First one is the following:

5 I have found strange teddy bear. I should keep it, maybe it would be useful in the future.
200 Amanda received her toy and in return she has shown me how to summon a bear.

second one:

10 Go to Springvale School and search for Amanda's toy.
20 Search for Amanda's teddy bear somewhere inside the building.
30 Go to the Clinic in Megaton and give to Amanda her teddy bear.
200 Amanda received her toy and in return she has shown me how to summon a bear.

and third:

50 Find or buy a teddy bear for Amanda, a girl from the Clinic in Megaton.
200 Amanda received her toy and in return she has shown me how to summon a bear.


In first part player first finds a teddy bear, then meets Amanda. In second path Player first speaks with Amanda, goes for a bear hunting, and then returns back to Amanda with her toy. At last, in third path Player speaks with Amanda and manages to convince her to forget about her toy in Springvale School, and Player gives her another teddy bear.

While preparing a story line and quest objectives, remember the following rule:

Player is a very clever and extremely tricky creature.
Be prepared for everything.

This means that we should anticipate every Player's move. The Bear Hunting quest can start not only after meeting with Amanda, because Player first can go to Springvale School and find her teddy bear.

I am sure you have also noticed a distinction on #10 and #20, the quest objectives that seem to be very similar – but they are not the same. Let's proceed to the Quest Targets and I will explain what I mean.


Quest Targets

Quest Targets are defined in the Quest Objectives Tab. You can add them to any objective, first by left clicking on an item of the objectives list, and then adding a Target Ref on the list below. You can choose any reference to the object in the world, but it must be a persistent reference.


I want to have only two targets in the quest, first for:

10 Go to Springvale School and search for Amanda's toy.

and second for:

30 Go to the Clinic in Megaton and give to Amanda her teddy bear.


Let's start with quest target for objective #10. It should be a map marker or a teleport door of the Springvale School, the main entrance, that link interior of the school with exterior area. I have chosen a door reference.

I don't close the Quest Window, only move it aside, so I can see Cell View window and Render Window. In the Cell View I switch to Wasteland world space and search for something like Springvale Elementary School. Got it - the cell ID is SpringvaleSchoolExterior.

In Render Window I move to the main entrance to the school, so I can see the door. Double click on the door to see if it is a persistent reference – it should be, and if so, I close the Reference window.

Now back to Quest Window and objective #10. Right click on Target Ref list and choose New to add a new quest target. I must change the target data, because it is pointing to some Abandoned Sewer cell. Below, in Quest Target Data I click on the Select Reference in Render Window button, move the mouse cursor on the door, so its color changes from red to white, and double click on the door. Quest Target is set, Target Ref may not change, but it only needs refreshing left click.

How to add more quest targets for one objective? Just fill in the list of Target Refs.

I do the same for objective #30, and as a target ref I use aBHAmandaFlowerREF, which was placed earlier in the MegatonClinic interior cell. I am not adding quest targets for any other objectives, especially not for #20, because in this quest stage Player must go into the Springvale School building and search for a teddy bear. I don't want to show on the map where this object is.


Quest Stages

It is second tab in the Quest Window. You can find here the Log Entries for each stage index and Result Scripts. There are also two very useful checkboxes: Complete Quest and Fail Quest. But let's start from the beginning.


In Oblivion, the Log Entries were used to make Player's journal updates, when Player made some progress in a quest. In Fallout 3 and New Vegas, there is no journal, only quest objectives with some information about current quest status and quest targets. It means that you can put in Log Entry whatever you want, it will not be displayed to Player in the game. In general:

  • quest stage indexes can be the same as for quest objectives,
  • result scripts can be used to set objectives displayed or completed,
  • Complete Quest / Fail Quest checkboxes are used to stop the quest and disable it in game.

And this is how I am doing it in my simple quest mod.


First fill in the list of Indexes by right clicking in the list and choosing New. Index numbers are the same as in Quest Objectives: 0, 5, 10, 20, 30, 50, 200 and on the end I add 210 as a final quest stage, so I also tick the Complete Quest checkbox. For each of stages, except #0, I right click on the list of Log Entries and add an EMPTY text.


For each quest stage I want to display a message about objectives to Player. To show current objective I can use SetObjectiveDisplayed script function, and SetObjectiveCompleted to show that previous objective is completed. I can do it by adding them to the Result Script of each stage – this is full list:

Quest Stage Result Script
0
5 SetObjectiveDisplayed aBHQuest 5 1
10 SetObjectiveDisplayed aBHQuest 10 1
20 SetObjectiveCompleted aBHQuest 10 1
SetObjectiveDisplayed aBHQuest 20 1
30 SetObjectiveCompleted aBHQuest 20 1
SetObjectiveDisplayed aBHQuest 30 1
50 SetObjectiveDisplayed aBHQuest 50 1
200 SetObjectiveCompleted aBHQuest 200 1
SetStage aBHQuest 210
210

Remember to compile each result script by clicking on the Compile Result button, just after adding it to the stage.

As you can see, these result scripts refer to each quest objective and the quest itself. The last stage #210 do not have any script, because it is flagged as Complete Quest. This means that even if it had a result script, this script wouldn't be processed. I am using stage #210 only to finish the quest.

If you want to save quest changes, never ever close the Quest Window by clicking on X, but click on the OK button in lower right corner of the window.

That's all for now, we can save the data and close the Quest Window.


Switching between quest stages

This is pure mechanics of the quest – we must decide when the quest should be updated, by switching one stage to another. If we make a mistake here, Player might not have an opportunity to finish the quest and will get stuck.


Our quest is active from the very beginning. Its first stage is #0 and next is #5 with the following objective:

5 I have found strange teddy bear. I should keep it, maybe it would be useful in the future.

This text will show up as a quest objective only when Player finds a teddy bear in Springvale School. It will also begin the quest in the game. To set up this stage we should use the teddy bear aBHTeddyBear and write a simple script. Open the Script Editor and let's begin with a new script – it will be an object script, so in the Script Type field you should set up "Object".

SCN aBHTeadyBearScript

This is the name of the script.

BEGIN onActivate
if (getActionRef == player)
	Activate
endif
END

Only player can take the teddy bear aBHTeddyBear, so we check if Player is activating it. If so, the object will be activated (taken, in this case), and if not, nothing will happen and the object we stay where it was.

BEGIN onAdd player

if (getStage aBHQuest < 5)
	setstage aBHQuest 5
endif

END

When the object is taken by the player and the quest stage is smaller than 5, we set up stage #5. We want to set this stage only once, that is why we check if the quest stage is less than 5.

When the quest is finished, its stage index is equal to the last active stage.

According to the scenario, Player can also first speak to Amanda, and then find the teddy bear, so actually when Player finds this item, the quest can be in stage #20. That is why we should add another condition – full OnAdd script block looks like this:

BEGIN onAdd player

if (getStage aBHQuest < 5)
	setstage aBHQuest 5
elseif (getStage aBHQuest <= 20)
	setstage aBHQuest 30
endif

END

Notice that I am using "less or equal" comparison. It is better than only "equal" and sometimes it allows to avoid mistakes. In the IF block first processed code is this:

if (getStage aBHQuest < 5)
	setstage aBHQuest 5

If it is true, the processing will go to endif, otherwise the second condition (elseif) is checked. Please note that in this quest the stages cannot be repeated and in game only one of those conditions will be met and the quest stage will be set only once.

Quest stages can be repeated in the game only if in the Quest Data there is a flag Allow repeated stages checked.

We can save the script, close the Script Editor and add it to the aBHTeddyBear. Next stage is #10:

10 Go to Springvale School and search for Amanda's toy.

This should be turned on after conversation between Amanda and Player, when Player agrees to find the teddy bear. We will do it in one of the dialogue topics later.

20 Search for Amanda's teddy bear somewhere inside the building.

This is next stage after #10: Player has met Amanda and went to Springvale School, following the quest target. This target was set by us on the SpringvaleSchoolDoor01toExteriorREF in Quest Objectives tab, for quest index #10. Now Player enters the school and we want to change the quest stage. Let's go SpringvaleSchool01 interior, activate it in the Render window and double click on SpringvaleSchoolDoor01toExteriorREF on the list of cell objects.


In front of the door we will create a primitive form, a trigger zone. Click on the icon with a cube and the T letter on the toolbar and draw a cubic object that will cover door's teleport marker. It will be a new base object, and I name it aBHSpringvaleSchoolTrigger.


To switch the quest stage, we need another object script:

SCN aBHQuestStageTriggerScript

BEGIN onTriggerEnter player

   if getStage aBHQuest == 10
      setStage aBHQuest 20
   endif

END

When Player enters the trigger zone and if quest stage index is equal to 10, and only then, we switch the stage to #20 – easy enough. Now assign this script to the aBHSpringvaleSchoolTrigger and we are done.

30 Go to the Clinic in Megaton and give to Amanda her teddy bear.
50 Find or buy a teddy bear for Amanda, a girl from the Clinic in Megaton.
200 Amanda received her toy and in return she has shown me how to summon a bear.

These stages will be set in a dialogue. But before we can do it, we must add some dialogue topics.


Dialogue Topics

I think this is the most exciting part of the work – dialogue. Dialogues are all about topics, links and conditions. Click on the Topics Tab. We can create as many topics, as we want, but some of them, already existing, are the special ones:

  • GREETING - every NPC in game begins a dialog with Player with a GREETING dialog topic. This topic is used only in the Topic tab of the quest window. In the Conversation tab there is a very similar topic – HELLO, but this one is generally used for conversations between two or more NPCs, without Player.
  • GOODBYE – every NPC has also a "bye bye" topic, that is used in the Conversation tab. If in the Topics tab you do not set up any topic flagged as "Goodbye", the dialog will end with one of those GOODBYEs from the Conversation tab.
  • SpeechChallengeFailure – this topic from the Topics tab is displayed when one of other topics is flagged as a speech challenge. It should be linked from this challenge topic.


Of course there are also some other special topics, but these three of them are the most important. If this is the first time when you make a dialog, then maybe you are a bit confused about those special topics – but do not worry, we will explain everything now, step by step.


We also need to know about two main dialog elements:

  • Response – this is what NPC says. Text of a response can added to selected topic in Info fields, and edited in Info Details. If you want to have continuous speaking on one topic, for selected Info you should add some texts in Response Text fields. By default max length is 150 chars.
  • Topic Text – this is what PC says, this a text displayed as a choice for Player in dialog menu, but only if the Prompt field is empty. If there is a text in the Prompt field, then it will be used instead of Topic Text.


Let's start. If you wish, you can take a look at the top of this page to see the dialog design again.


Adding special topics

Every dialogue starts with a NPC greeting, so we must add it in our quest. Actually it is not a must, but it is always better to have a custom greeting for a custom quest.


In the quest window go to the Topics Tab, right click on the list to the left of the window and choose Add Topic option. The Select Topic window will open, with a list of all topics that were not used in selected quest. Search for the GREETING topic, left click on it and approve the selection by clicking on the OK button (or double-left click on the topic).


Now we have a GREETING in our quest, however we cannot leave it as is, we must add our own text of the greeting. In game there are already many GREETING topics, but each of them use different texts, different Info entries. We only borrow the GREETING topic ID, which is the special one, used by NPC to greet Player.


Right click on the Info list and New, and the New Response window will open. In Response Text we enter the following text:

  • Can I ask you a question?


If you wish, in Script Notes and Edit fields you can add some notes. In Idle Animations you can set up some animations for a Speaker (NPC is speaking the greeting); Player is a Listener, so in this case we cannot use any animations. These fields refer only to NPC. In Audio settings it is possible to choose an Emotion Type for the response, as well as an Emotion Value; the greater value, the more emotions are on the Speaker. Voice filenames are handled automatically, we don't need them, unless you record your own voiceover for dialogues.


Close the New Response window. In the Quest window, in upper right corner there are some useful options:

  • Top-level checkbox – tick it and the response will show up as first on the list of available topics in dialog menu in game.
  • Rumors – not used.
  • Priority – by default it is the same value as the priority value of the quest. You can change it to manipulate topics order on the list of available topics in dialog menu in game.


This text should be spoken by Amanda only once, so I also tick the Say Once checkbox.


In my quest there is another greeting. Add it by right click on an empty line of the Info list. The response text is this:

  • Do you have a teddy bear for me?


This text can be repeated many times, while doing the quest Player can always speak with Amanda, so I do not tick the "Say Once" checkbox.

More information about flags you can find at Category:Dialogue page.

Later we will come back to this topic and add some conditions and links, but now let's fill the list with other topics.


Adding custom topics

In my scenario, after the greeting there is a choice for Player, a topic aBHTopicWelcome with the following text:

  • Hello young lady. What can I do for you?


To add this topic, right click on the list to the left of the window and choose Add Topic option. The Select Topic window will open, with a list of all already existing topics. There is no aBHTopicWelcome, so we must add it – the steps are simple and we do as usual: right click on the list in the Select Topic window and New; enter aBHTopicWelcome as a topic ID.


We have our custom topic on the list. As you can see in the upper side of the quest window, the Topic Text is the same as topic ID: aBHTopicWelcome. Let's leave it as is.

Now create another new Info with the response text:

  • Could you find my teddy bear please?

and add Player's choice text in the Prompt field. Click in this field and enter:

  • Hello young lady. What can I do for you?

Amanda will say this response after she greets Player and when Player clicks on Hello young lady. What can I do for you? dialog choice in dialog menu. Easy, isn't it? Right click once again on an empty line in Response Texts list and add another entry:

  • I lost it in Springdale School while I was escaping with my mother.


This is Amanda's another response. She will say it just after the previous one. Third response is the following:

  • He was my friend... Find him please...


I also check the Say Once checkbox for this topics.


Add the rest of topics:

Topic ID: aBHTopicAgree
Prompt: OK, I will bring it for you.
Response: Thank you. I will be waiting for your return.
Flags: Say Once, Goodbye


Topic ID: aBHTopicAgreeWithChallenge
Prompt: Maybe I will give you another teddy bear, what you say, eh?
Response: OK, I will take it, thanks.
Flags: Say Once, Goodbye

This is my challenge topic. Tick the Speech Challenge checkbox and set difficulty level.


Topic ID: aBHTopicByeBye
Prompt: I must go now.
Response: Bye bye.
Flags: Goodbye


Topic ID: aBHTopicDisagree
Prompt: What? I have better things to do. Get lost.
Response: I don't like you.
Flags: Goodbye


Topic ID: aBHTopicNotYet
Prompt: No, not yet.
Response: So please hurry. He is the dearest friend of mine.
Flags: Goodbye


Topic ID: aBHTopicHaveTeddyBear
Prompt: Yes, I have found a toy with your name on it. Here it is.
Response: Thank you.
As a reward I will teach you how to summon a friend, a bear, so you will never be alone anymore.
Flags: Say Once, Goodbye


Topic ID: aBHTopicHaveTeddyBear
Prompt: Yes, I have this toy. Here it is.
Response: Thank you.
As a reward I will teach you how to summon a friend, a bear, so you will never be alone anymore.
Flags: Say Once, Goodbye


There are two different Prompts for aBHTopicHaveTeddyBear topic, because there are also two different ways for Player to do the quest: finding the teddy bear and then speaking with Amanda or speaking with Amanda first, and finding the quest item.

Linking the topics

There are two ways for linking the topics:

  1. the first one is a bit difficult and we will not use it here, but it is possible to add a topic to the game with AddTopic script function or via "Add Topics" field in the Topics tab. Then, using quest variables and topic conditions, you can control which topics should be displayed in dialog menu.
  2. the second one is simple and easy to understand: use the "Choices" field of the Topics tab, and control the topics only via topic conditions.


There also two different ways to run the dialogue, two types of the dialogue:

  1. Linear dialogue, linked choices – it is starting with a GREETING, then there are some topics linked to the greeting, and each of those choice topics, on the end of conversation chain, has the Goodbye flag.
  2. Player's choice dialogue, list of topics – this one is also starting with a GREETING, but there are no linked Choice topics. Player has a dialog menu with topics, usually added to the game by the AddTopic function.


Of course you can mix these types. The important thing to remember is that if you have first type of a dialogue, and the last choice topic in chain doesn't have the Goodbye flag, instead of goodbye the dialog will go to the second type and in dialog menu Player will have a list of topics, and one them will have to have a Goodbye flag. If not, then on the dialog list in game there will be one generic GOODBYE topic from the Conversation tab – even if you don't use this tab in your quest, each NPC has some generic topics and GOODBYE is one of them. You can check it by opening NPC properties window and clicking on the Dialogue button.


Let's go back to the point and link some topics. In my quest the dialogue is simple, so there will not be too many links. Click on the GREETING topic and "Can I ask you a question?" Info text. For this I have planned only one Player's choice, that is topic aBHTopicWelcome. Right click in the Choices field and add this topic.


Following the dialog, click on the aBHTopicWelcome topic. When Amanda asks Player to find her toy, Player will have several options:

  • aBHTopicAgreeWithChallenge
  • aBHTopicAgree
  • aBHTopicDisagree
  • aBHTopicHaveTeddyBear
  • aBHTopicByeBye

Add each of this topics in Choices field of aBHTopicWelcome topic.


Now go back to the GREETING and click on the second response with "Do you have a teddy bear for me?" Info text. This time there is a list full of possibilities. The Choices field should contain the following topics:

  • aBHTopicHaveTeddyBear
  • aBHTopicNotYet
  • aBHTopicDisagree
  • aBHTopicAgree
  • aBHTopicByeBye


The first three choice topics are simple: Player has the teddy bear, doesn't have it yet or disagree to bring it. This second GREETING Info text doesn't have the Say Once flag, it can be used in game many times. At first talk with Amanda Player can refuse to help her, that is why it should be another possibility to start the quest with aBHTopicAgree topic. I have also added the ByeBye to prevent displaying a generic GOODBYE.


Linking the challenge topic

First we must add another special topic: SpeechChallengeFailure. You already know what it is for, don't you? This is only a response topic, it should have no Prompts. The response is the following:

  • No, he is my friend, a special one.


It should be linked from aBHTopicAgreeWithChallenge topic, so add it in the Link From field. Now, in game, if Player succeed with a speech challenge, the response will be taken from aBHTopicAgreeWithChallenge. In case of failure, there will be displayed SpeechChallengeFailure response.

That's all about linking. Let's make some conditions.


Conditions

These are very important for the quest. If there are no conditions for the topics, every one of them will be displayed almost always and every NPC could use them.

The first condition is very simple and very common – the dialogue can take place only between Player and Amanda. Right click on an empty line of the Conditions and add New entry. You will get the Condition Item window with some fields to be filled in:

  • Condition Function: by default it is GetIsID function. This is the most common function for dialogue topic conditions, that is why it is default, and this is exactly what we want now. Do not change it.
  • Function Parameters: According to the function type, in this field it is possible to give some parameters. If the condition function has parameters, this field will be enabled, otherwise it will be not possible to choose any parameters. GetIsID has one parameter: an object. Click on it and set aBHAmandaFlower as a parameter.
  • Comparison: '==' is OK.
  • Value: 1.0000 is OK.
  • Run on: Subject. This means that condition will be applied to the talking subject, and it is always NPC. If you want to run a condition on Player, you should choose a Target. If the function is run on non-actor, use Subject, Reference or Linked Reference.


There are also two checkboxes:

  • Use Global: tick it if you want to compare the value returned from condition function with a global variable instead of number.
  • Or: Used only if there are more than one conditions for a topic and when it is necessary to use two or more different conditions. This is logical operator OR. If this checkbox is empty, logical operator AND will be used.

More information about condition settings are at Category:Conditions page.

The condition is the following:

  • (Run on: Subject) GetIsID aBHAmandaFlower == 1.0000 (AND)


I am adding it to every topic of my quest, so only Amanda can use them.

This is not enough, because I want some topic to be displayed only if the quest is at some stage. Let's start with the GREETING topic. The "Can I ask you a question?" info text should be displayed only if quest aBHQuest stage index is less or equal to 5. This means the info text of this topic will be used only if the quest haven't started in the game or if Player finds the quest item without speaking to Amanda. So the condition is the following:

  • (Run on: Subject) GetStage aBHQuest <= 5.0000 (AND)


Now we have two conditions for the first info text and both of them must be met if the text should be displayed, because we are using the AND operator.

The second info of the GREETING: Do you have a teddy bear for me? – should be displayed only if quest stage index is less than or equal to 50. Add it. Here's is short list of additional conditions for other topics:


  • aBHTopicAgree:

- quest stage index must be less than 5


  • aBHTopicAgreeWithChallenge:

- quest stage index must be less than 5

Amanda is a kid, so if you want, you can also add the following condtion:
(Run on: Target) HasPerk ChildAtHeart == 1.0000

This will check, if Player has a ChildAtHeart perk.


  • aBHTopicHaveTeddyBear, the first info text:

- quest stage index must be equal to 5 (OR)
- quest stage index must be equal to 30 (AND)
- Player has the aBHTeddyBear item


  • aBHTopicHaveTeddyBear, the second info text:

- quest stage index must be equal to 50 (AND)
- Player has the aBHTeddyBear item


To check if Player has this teddy bear, you can use GetItemCount function. And remember to run this condition item on the Target.


  • aBHTopicNotYet:

- quest stage index must be greater than or equal to 10 (AND)
- quest stage index must be less than 50 (AND)

Result scripts

Finally, we need some result scripts to manage the quest. The first one will be used when Player agrees to help Amanda. Left click on the aBHTopicAgree and in the Result Script (End) enter the following code:

SetStage aBHQuest 10

Click on the Compile Scripts button to check if the code is correct and to compile it.

I do a very similar thing for the aBHTopicAgreeWithChallenge topic - this is the script:

SetStage aBHQuest 30

The last script is for aBHTopicHaveTeddyBear topic, when Player has aBHTeddyBear item and meets Amanda:

player.removeitem aBHTeddyBear 1
if (GetStage aBHQuest == 30)
   SetObjectiveCompleted aBHQuest 30 1
else
   SetObjectiveCompleted aBHQuest 5 1
endif
SetObjectiveDisplayed aBHQuest 200 1
SetStage aBHQuest 200

With this script we take the item from Player, according to the quest stage we mark proper quest objective as completed, and set the final stage.


Now click on the OK button and save the plugin. I think it is good time to test it in game.

Remember not to declare variables in dialogue result scripts, it will cause quest variables to be overwritten.

I hope you enjoyed the tutorial and you find it useful.