Difference between revisions of "A beginner's guide, lesson 6 - Quest Dialogue"

m
adding internal links, correcting a few spelling errors
imported>Nightlithium
imported>Qazaaq
m (adding internal links, correcting a few spelling errors)
Line 38: Line 38:
==Introduction==
==Introduction==


Well, we come to it at last. It is time for us to begin to create our own quest, to design our own NPCs, and to write our own scripts.  
Well, we come to it at last. It is time for us to begin to create our own quest, to design our own [[NPC]]s, and to write our own [[Named Scripts|scripts]].  
Of course it's ridiculous to suggest that these tutorials alone will teach you everything you need to know. However, I hope by the time you finish the next few lessons you will be more comfortable with the key skills needed to create your own great works. The exemple quest that I am using is not intended as an example of ‘Good Practice'. I have designed it to illustrate techniques, not good quest writing. The actual details of this quest are fairly unimportant. What matters are the techniques we are using.
Of course it's ridiculous to suggest that these tutorials alone will teach you everything you need to know. However, I hope by the time you finish the next few lessons you will be more comfortable with the key skills needed to create your own great works. The example [[quest]] that I am using is not intended as an example of ‘Good Practice'. I have designed it to illustrate techniques, not good quest writing. The actual details of this quest are fairly unimportant. What matters are the techniques we are using.


The next three lessons will work to develop a quality version of a quest. While we will do this exercise, I have designed the quest to allow us to focus on key skills as we go on. This lesson deals with the creation of dialogue.  In lesson seven we will really turn our focus to scripting, although you will begin scripting in this lesson. The eighth lesson will complete the quest by focusing on AI and Audio.
The next three lessons will work to develop a quality version of a quest. While we will do this exercise, I have designed the quest to allow us to focus on key skills as we go on. This lesson deals with the creation of dialogue.  In lesson seven we will really turn our focus to scripting, although you will begin scripting in this lesson. The eighth lesson will complete the quest by focusing on AI and Audio.
Line 121: Line 121:
==Adding an NPC==
==Adding an NPC==


You can of course create an NPC from scratch. If you right click in the Actor section of the object menu and select NEW a new NPC interface pops up. However, I cannot see any good reason to do this, and since you will have to add every aspect of your NEW NPC, including animations, there are many good reasons not to do this.  
You can of course create an NPC from scratch. If you right click in the Actor section of the object menu and select NEW a new NPC interface pops up. However, I cannot see any good reason to do this, and since you will have to add every aspect of your NEW NPC, including [[animation]]s, there are many good reasons not to do this.  


It is far easier to edit an existing NPC. We want Vilanus to be an Imperial, so let's select an existing NPC who is an imperial. We don't actually have to choose an Imperial, but it saves us a job. Avoid NPCs with scripts attached. Again, you can do so but you will need to remove the script which is an extra job. I usually look for NPCs who have either a 1 or a 0, preferably a 0, in the user column. This means they are hardly used in the game. Let's chose the actor called TestORMale as our base.  
It is far easier to edit an existing NPC. We want Vilanus to be an Imperial, so let's select an existing NPC who is an imperial. We don't actually have to choose an Imperial, but it saves us a job. Avoid NPCs with scripts attached. Again, you can do so but you will need to remove the script which is an extra job. I usually look for NPCs who have either a 1 or a 0, preferably a 0, in the user column. This means they are hardly used in the game. Let's chose the actor called TestORMale as our base.  
Line 127: Line 127:
We will place our NPC in the Foyer of the Imperial Hotel in the Talos District. Again this is an arbitrary choice, based on the fact that Taverns, Inns, and hotels contain public spaces which are ideal for casual contacts. We could of course if we wished to use this NPC again build him a house or office to work from.  
We will place our NPC in the Foyer of the Imperial Hotel in the Talos District. Again this is an arbitrary choice, based on the fact that Taverns, Inns, and hotels contain public spaces which are ideal for casual contacts. We could of course if we wished to use this NPC again build him a house or office to work from.  


Drag and Drop the base NPC into Render window. F key him to get him in position.
Drag and Drop the base NPC into [[Render Window]]. F key him to get him in position.


Now double click on him to open up his details.  
Now double click on him to open up his details.  
Line 142: Line 142:
   
   
;Class  
;Class  
Can be defined using the class interface from the menu bar.
Can be defined using the [[class]] interface from the menu bar.


;Summonable  
;Summonable  
Line 154: Line 154:


;Race  
;Race  
Straightforward - choose a race from the drop-down menu
Straightforward - choose a [[race]] from the drop-down menu


;Female  
;Female  
Line 160: Line 160:


;Combat Style  
;Combat Style  
combat styles influence NPC choices during a fight. (see lesson eight)
[[Combat Style]]s influence NPC choices during a fight. (see lesson eight)


;Death Item  
;Death Item  
Line 191: Line 191:
We can also alter the inventory if we wish. Again by careful pre-selection we can save ourselves a job. Remember to scroll across the information in the object window to select suitable characters that match your requirements as closely as possible, to reduce how much work you need to do.
We can also alter the inventory if we wish. Again by careful pre-selection we can save ourselves a job. Remember to scroll across the information in the object window to select suitable characters that match your requirements as closely as possible, to reduce how much work you need to do.


We want Vilanus to be a rich merchant so he should have some decent clothes, and TestORmale fit's the bill. We should also remove any weapons and armour from him as he is supposed to be a lawyer. (Note the Hammer may show up in the render window until you reload the window, but will not show up in the game.  
We want Vilanus to be a rich merchant so he should have some decent clothes, and TestORmale fit's the bill. We should also remove any weapons and armor from him as he is supposed to be a lawyer. (Note the Hammer may show up in the render window until you reload the window, but will not show up in the game.  


We can leave his faction details alone for now.
We can leave his faction details alone for now.
Line 239: Line 239:
==Quest Conditions==
==Quest Conditions==


At the moment this as blank. We are going to input a generic conditions which has the effect of limiting any conversations and dialogue topic we create in this quest to characters we would expect to speak, and exclude those we don't like Goblins and Horses.
At the moment this as blank. We are going to input a generic [[condition]]s which has the effect of limiting any conversations and dialogue topic we create in this quest to characters we would expect to speak, and exclude those we don't like Goblins and Horses.


The conditions are applied to the person speaking the line, called the object. Click the NEW button at the bottom of the page.  
The conditions are applied to the person speaking the line, called the object. Click the NEW button at the bottom of the page.  
Line 247: Line 247:
===Condition Function===
===Condition Function===


This is the basis of you condition. It initially defaults to the condition GetDisposition, but clicking on this opens up a long list in a drop down window. This contains the valid functions that can be used in a conditional statement. (See later for IF-ENDIF BLOCKS)
This is the basis of your condition. It initially defaults to the condition [[GetDisposition]], but clicking on this opens up a long list in a drop down window. This contains the valid functions that can be used in a conditional statement. (See later for IF-ENDIF BLOCKS)


These can be divided into sets of similar functions which I have chosen to call families.
These can be divided into sets of similar functions which I have chosen to call families.
Line 263: Line 263:
Several functions require a parameter to work. Several don't. It depends on the function.
Several functions require a parameter to work. Several don't. It depends on the function.


For Example the Function GetRace requires you to select a valid race from a drop down menu for it to make sense. While GetIsPlayableRace has no parameters.
For Example the Function [[GetRace]] requires you to select a valid race from a drop down menu for it to make sense. While [[GetIsPlayableRace]] has no parameters.


===Comparison===
===Comparison===
Line 295: Line 295:
We have completed the basic set up for our quest.
We have completed the basic set up for our quest.


Now let's select the Quest Stage tab.
Now let's select the [[Quest Stages Tab]].


Again this is blank. We can add stages in the same way as we added the quest. In the column marked Quest Stages, right click and select new. The pop-up expects a number between 0-255. We tend to use 10, 20 30 etc to allow room for extra stages. Go ahead and enter 10.  
Again this is blank. We can add stages in the same way as we added the quest. In the column marked Quest Stages, right click and select new. The pop-up expects a number between 0-255. We tend to use 10, 20 30 etc to allow room for extra stages. Go ahead and enter 10.  
Line 314: Line 314:
Let's add some.  
Let's add some.  


Select the Topic tab, from the Quest pop up. DO NOT use filtered dialogue to add topics. This can lead to mod confliction issues.
Select the [[Topics Tab]], from the Quest pop up. DO NOT use filtered dialogue to add topics. This can lead to mod confliction issues.


Again this is blank to begin with. We will add a topic which will be used at the start of the quest.
Again this is blank to begin with. We will add a topic which will be used at the start of the quest.
Line 358: Line 358:
I have assumed that you have never programmed before in writing this tutorial. If you have you will be at an advantage when it comes to writing scripts.
I have assumed that you have never programmed before in writing this tutorial. If you have you will be at an advantage when it comes to writing scripts.


Commands and Functions:  
[[Command]]s and [[Function]]s:  


These are the formal instructions that you place in the script to tell the game what you want it to do. The Wiki makes a distinction between what these do. It should be noticed, the differences for beginners may appear very slight.
These are the formal instructions that you place in the script to tell the game what you want it to do. The Wiki makes a distinction between what these do. It should be noticed, the differences for beginners may appear very slight.
Line 364: Line 364:
The commands are:
The commands are:


;ScriptName
;[[Scriptname]]
-Used to identify the script obviously
-Used to identify the script obviously


;Declarations
;[[Variable|Declarations]]
-These are a set of descriptors which identify the VARIABLES used in a script
-These are a set of descriptors which identify the VARIABLES used in a script


;Begin-End
;[[Begin|Begin-End]]
-Used in conjunction with each other to create BLOCKS of script.
-Used in conjunction with each other to create BLOCKS of script.


;If-EndIf
;[[If|If-EndIf]]
-Used together with optional ElseIf and Else commands to form CONDITIONAL blocks.
-Used together with optional ElseIf and Else commands to form CONDITIONAL blocks.


;Return
;[[Return]]
-Use to break a scripts running for that run only.
-Use to break a scripts running for that run only.


;Set
;[[Set]]
-Used to assign new values to variables
-Used to assign new values to variables


;“.” or Use Reference
;“.” or [[UseReference|Use Reference]]
The full stop or period “.” is a command which identifies the REFERENCE that a FUNCTION should use.
The full stop or period “.” is a command which identifies the REFERENCE that a FUNCTION should use.


Line 396: Line 396:
*SHOWsomething
*SHOWsomething


;Variables
;[[Variable]]s
One way to think of variables is as a container which stores a number. The different variables types, Short, Long etc. determined how big a container will be assigned to that variable name.
One way to think of variables is as a container which stores a number. The different variables types, Short, Long etc. determined how big a container will be assigned to that variable name.


Line 419: Line 419:
Here gold001 is the object id
Here gold001 is the object id


;Reference ID
;[[Reference]] ID
Several functions work by changing a specific example of an object. There may be many chests of a particular object type in the game and you want to add gold to only one of them. The reference ID is a unique identifier for that instance of an object. You add the reference by double clicking on the example in the render window (or by selecting edit from the cell objects window). In the object pop up dialogue box you add a unique name to the reference id box. Note that for this to happen the object must be placed in a cell. To use this reference in a script you will need to click the persistent reference check box. This tells the game to always remember that object even if the PC leaves the cell that it is in.
Several functions work by changing a specific example of an object. There may be many chests of a particular object type in the game and you want to add gold to only one of them. The reference ID is a unique identifier for that instance of an object. You add the reference by double clicking on the example in the render window (or by selecting edit from the cell objects window). In the object pop up dialogue box you add a unique name to the reference id box. Note that for this to happen the object must be placed in a cell. To use this reference in a script you will need to click the persistent reference check box. This tells the game to always remember that object even if the PC leaves the cell that it is in.


Line 447: Line 447:
==The Script Editing Window==
==The Script Editing Window==


The script editor is in essence, a very basic text editor, used for writing and editing scripts. Many scripters use external text editors like notepad, notepad++, Crimson Editor, etc. to develop long scripts. One reason for this is that the script editor will only save compiled scripts which must be 100% correct. It also allows you to keep a back-up version.  
The [[Edit Scripts|script editor]] is in essence, a very basic text editor, used for writing and editing scripts. Many scripters use external text editors like notepad, notepad++, Crimson Editor, etc. to develop long scripts. One reason for this is that the script editor will only save compiled scripts which must be 100% correct. It also allows you to keep a back-up version.  


I personally keep a large library of scripts. Some that I have written, and loads copied from forums and other mods. I can then refer to these when I need a solution to a problem.
I personally keep a large library of scripts. Some that I have written, and loads copied from forums and other mods. I can then refer to these when I need a solution to a problem.
Line 503: Line 503:
Finally there is a drop down menu. This allows you to select the script type. There are 4 types of script, but results scripts are not edited or compiled in the script editor. We will see this shortly.  
Finally there is a drop down menu. This allows you to select the script type. There are 4 types of script, but results scripts are not edited or compiled in the script editor. We will see this shortly.  


The scripts written in this editor can be Object, Quest, or Magic effect. This setting determines which objects in the editor the script can be attached to. Each script type is run in a slightly different way and it is important to let the game know which one you want your script to be.  
The scripts written in this editor can be [[Object scripts|Object]], [[Quest scripts|Quest]], or [[Magic effect scripts|Magic effect]]. This setting determines which objects in the editor the script can be attached to. Each script type is run in a slightly different way and it is important to let the game know which one you want your script to be.  
You can edit or change this at a later date if you make an error.
You can edit or change this at a later date if you make an error.


Line 581: Line 581:
Now we need to attach the script to our quest.  
Now we need to attach the script to our quest.  


Open up the Quest data Tab for our quest.   
Open up the [[Quest Data Tab]] for our quest.   
Where it says script open the drop down menu and scroll down to find the BGM001QuestScript. Click on this and you're done.  
Where it says script open the drop down menu and scroll down to find the BGM001QuestScript. Click on this and you're done.  


Line 729: Line 729:
==Conditions==
==Conditions==


The conditions box in the Topic Tab is used to limit who gets to say a particular response.
The conditions box in the Topics Tab is used to limit who gets to say a particular response.


We can limit this in many ways
We can limit this in many ways


For example, Restrict by group (GetInFaction), race (GetRace) or limit to only one NPC (GetIsID),Restrict by Worldspace, City, Cell or distance from a particular chair, Restrict by Game Time, Season, Weather or progress of quest
For example, Restrict by group ([[GetInFaction]]), race ([[GetRace]]) or limit to only one NPC ([[GetIsID]]),Restrict by Worldspace, City, Cell or distance from a particular chair, Restrict by Game Time, Season, Weather or progress of quest.


Open up the topic tab, select the BGMMessage4u topic and highlight the response we have added earlier.
Open up the topics tab, select the BGMMessage4u topic and highlight the response we have added earlier.


At the bottom of the window is the condition box.  
At the bottom of the window is the condition box.  
Line 764: Line 764:
Select Argonian from the list.  
Select Argonian from the list.  
The comparison reads == which is correct.  
The comparison reads == which is correct.  
The value current reads 1.000. This is mathematic speak for a true response.  
The value current reads 1.000. This is mathematical speak for a true response.  
We want to change this to the false response 0.000.
We want to change this to the false response 0.000.


In English this means:  
In English this means:  


Look at the Actor who might say this response. Check what race they are in. If they are not an Argonian (Argonian== 0.000) then carry on.  
Look at the Actor who might say this response. Check what race they are in. If they are not an Argonian (Argonian == 0.000) then carry on.  
If they are an Argonian they fail this condition and they cannot say this line.
If they are an Argonian they fail this condition and they cannot say this line.


Line 810: Line 810:
(This is an inclusive condition, since it includes a group in that response.)  
(This is an inclusive condition, since it includes a group in that response.)  


Another way to select groups is by using factions (see lesson 7 for more details on creating a Faction)
Another way to select groups is by using [[faction]]s (see lesson 7 for more details on creating a Faction)
   
   
One such faction is the ICFaction. It groups all the NPCs who are considered citizens of this city. It is a useful way to distinguish between the merchants', soldiers, and workers of the capital and a tourist from Chorrol who is passing through. We can use this to again include or exclude factions
One such faction is the ICFaction. It groups all the NPCs who are considered citizens of this city. It is a useful way to distinguish between the merchants', soldiers, and workers of the capital and a tourist from Chorrol who is passing through. We can use this to again include or exclude factions
Line 816: Line 816:
Set up a NEW condition.  
Set up a NEW condition.  


Choose the GetInFaction function, and then choose the ICFaction from the list to get a new condition
Choose the [[GetInFaction]] function, and then choose the ICFaction from the list to get a new condition
Finally we want to exclude our NPC Vilanus Villa from saying these lines. This is why we added him to the game first.
Finally we want to exclude our NPC Vilanus Villa from saying these lines. This is why we added him to the game first.
To do this we use the condition function GetIsID.  
To do this we use the condition function [[GetIsID]].  
Then from the parameter list select BGVilanusVilla.   
Then from the parameter list select BGVilanusVilla.   
Remember to set the value to 0 so that your condition doesn't include him.
Remember to set the value to 0 so that your condition doesn't include him.
Line 825: Line 825:


Create a new condition.  
Create a new condition.  
Choose the GetStage Function, then select our quest (BGM001) from the list. Change the 'Comparison' to < (less than), and the value to ten.  
Choose the [[GetStage]] Function, then select our quest (BGM001) from the list. Change the 'Comparison' to < (less than), and the value to ten.  
This runs a check to ensure the PC hasn't advanced at all in the quest, effectively removing it from all NPC's if it has.
This runs a check to ensure the PC hasn't advanced at all in the quest, effectively removing it from all NPC's if it has.


Line 834: Line 834:
First create a new topic called BGMVilanusVilla using the method we have just used (Right Click-New). You can leave the response blank for now.
First create a new topic called BGMVilanusVilla using the method we have just used (Right Click-New). You can leave the response blank for now.


On the Right hand side of the Topic Tab window are three boxes called
On the Right hand side of the [[Topics Tab]] window are three boxes called


;Add Topic
;Add Topic
Line 881: Line 881:
==Stage Update==
==Stage Update==


Now return to the quest stage tab.
Now return to the quest stages tab.


We have now progressed through the quest to stage 10. We can of course leave this blank. Sometimes we want to stage bump simply to activate/deactivate conditions that use the GetStage function.  
We have now progressed through the quest to stage 10. We can of course leave this blank. Sometimes we want to stage bump simply to activate/deactivate conditions that use the GetStage function.  
Line 910: Line 910:
This response is fine, unless of course we are already in the Talos district.
This response is fine, unless of course we are already in the Talos district.
   
   
We need to add one more condition to account for this by using the GetInCell function.
We need to add one more condition to account for this by using the [[GetInCell]] function.
{| class="wikitable" border="1" cellpadding="5"
{| class="wikitable" border="1" cellpadding="5"
|-
|-
Line 967: Line 967:
Another way to pass on information via dialogues is to use the GREETING topic. If you remember the discussion in lesson four about how conversations work, all dialogues begin with a GREETING, which is selected by the game from the GREETING topic.  
Another way to pass on information via dialogues is to use the GREETING topic. If you remember the discussion in lesson four about how conversations work, all dialogues begin with a GREETING, which is selected by the game from the GREETING topic.  
If we add our own greeting and set the right conditions we can force a start to a dialogue.  
If we add our own greeting and set the right conditions we can force a start to a dialogue.  
In the topic tab select Right Click-Add and add GREETING. This already exists so you will not need to create a new topic when the list appears.
In the topics tab select Right Click-Add and add GREETING. This already exists so you will not need to create a new topic when the list appears.


We can now add Vilanus Villa's little speech.  
We can now add Vilanus Villa's little speech.  
Line 978: Line 978:
Now click OK to add the response.
Now click OK to add the response.


Then in the centre response details box, not the upper info  box, right click and add a new response. You'll get a new interface to write in.
Then in the center response details box, not the upper info  box, right click and add a new response. You'll get a new interface to write in.


:''Your uncle has passed away peacefully in his sleep.
:''Your uncle has passed away peacefully in his sleep.
Line 1,012: Line 1,012:
Now add this by now familiar script function to the result script for this info response.
Now add this by now familiar script function to the result script for this info response.


  AddTopic BGWill
AddTopic BGWill


Job Done.
Job Done.
Line 1,037: Line 1,037:
Let's try this
Let's try this


Add a new variable called MetVilla to the top of the Quest Script (under the quest data tab). We need to declare any variables used in results scripts in the quest script . Think of the results scripts as children of the parent quest script. We declare the childs variables in the parent script.
Add a new variable called MetVilla to the top of the Quest Script (under the quest data tab). We need to declare any variables used in results scripts in the quest script . Think of the results scripts as children of the parent quest script. We declare the child-variables in the parent script.


This is automatically set at zero. We can use the response result box to bump this up to one after speech with this bit of script .
This is automatically set at zero. We can use the response result box to bump this up to one after speech with this bit of script.


   Set BGM001.MetVilla to 1
   Set BGM001.MetVilla to 1
Line 1,090: Line 1,090:
The first time we greet him he gives the longer speech, the second time a shorter one.
The first time we greet him he gives the longer speech, the second time a shorter one.


We can now add another multi line response info to the BGWill topic added by the first response.  
We can now add another multi-line response info to the BGWill topic added by the first response.  


Try this one yourself using this summary to guide you.  
Try this one yourself using this summary to guide you.  
Line 1,261: Line 1,261:
==Locating the Cottage==
==Locating the Cottage==


''If you are using BGModTutBase.esp, you can use these cells: BGModCourierCottage in the Interiors world space, and CourierCottageExt in the Tamriel world space. The exterior building that matches the cottage is LeyawiinHouseLower03, and the door is LeyawiinLowerLoadDoor01.''
''If you are using BGModTutBase.esp, you can use these cells: BGModCourierCottage in the Interiors [[world space]], and CourierCottageExt in the Tamriel world space. The exterior building that matches the cottage is LeyawiinHouseLower03, and the door is LeyawiinLowerLoadDoor01.''


The cottage could be located anywhere in Tamriel. I think I've looked at just about every cell in compiling these tutorials and working on my mods. When selecting the location for this cottage, I took into account several factors. I wanted it to be West of Chorrol. I wanted it to be close to the main road. I knew I couldn't go too far as the road abruptly ends by a cliff, marking the edge of the Worldspace. I also decided to use the game to give me a little bonus or two.
The cottage could be located anywhere in Tamriel. I think I've looked at just about every [[cell]] in compiling these tutorials and working on my mods. When selecting the location for this cottage, I took into account several factors. I wanted it to be West of Chorrol. I wanted it to be close to the main road. I knew I couldn't go too far as the road abruptly ends by a cliff, marking the edge of the world space. I also decided to use the game to give me a little bonus or two.


Around this location, is a dungeon with some external guardians, some bandits and an oblivion gate. This means any NPC will be harassed by bad guys that we don't have to work too hard to create.
Around this location, is a dungeon with some external guardians, some bandits and an oblivion gate. This means any NPC will be harassed by bad guys that we don't have to work too hard to create.
Line 1,317: Line 1,317:
We need to add two other items to the cottage.
We need to add two other items to the cottage.


We need to add an xmarker to the interior and the exterior a map marker.
We need to add an [[XMarker]] to the interior and the exterior a [[map marker]].


We will find these under the Static Objects.
We will find these under the Static Objects.


Drop an xmarker or anxmarkerheading object inside the cottage and give it a reference name like BgCourierLodgeXMarker.
Drop an xmarker or an [[XMarkerHeading]] object inside the cottage and give it a reference name like BgCourierLodgeXMarker.


Now select a MapMarker and drop it just outside the cottage door, in the exterior cell.
Now select a MapMarker and drop it just outside the cottage door, in the exterior cell.
Line 1,336: Line 1,336:
We need to add a bit of script to enable it. First we need to add a bit more conversation.
We need to add a bit of script to enable it. First we need to add a bit more conversation.


Add the following multi line response and set conditions to limit it to Hubart and the current stage. First add stage 30 in the stage tab.
Add the following multi-line response and set conditions to limit it to Hubart and the current stage. First add stage 30 in the stage tab.




Line 1,379: Line 1,379:
This activates the map marker and gives the player the key to the cottage.
This activates the map marker and gives the player the key to the cottage.


The Syntax for the ShowMap Function is
The Syntax for the [[ShowMap]] Function is


ShowMap MapMarkerID, enableFastTravel (optional)
ShowMap MapMarkerID, enableFastTravel (optional)
Anonymous user