Difference between revisions of "Part 4: adding the skillbook to a vendor"

From Divinity Engine Wiki
Jump to: navigation, search
m
m (Protected "Part 4: adding the skillbook to a vendor" ([Edit=⧼protect-level-larianeditonly⧽] (indefinite) [Move=⧼protect-level-larianeditonly⧽] (indefinite)))
 
(20 intermediate revisions by one other user not shown)
Line 13: Line 13:
 
|}
 
|}
  
The data used in this article was created in parts 1 & 2 of the series.
+
The data used in this article was created in parts 2 & 3 of the series.
  
 
<br />
 
<br />
Line 19: Line 19:
 
Vendors are NPC characters that buy or sell items. In order to assign our skillbook to a vendor npc, we will need to do a couple of things:
 
Vendors are NPC characters that buy or sell items. In order to assign our skillbook to a vendor npc, we will need to do a couple of things:
 
# Create a treasure table
 
# Create a treasure table
# Create a vendor
+
# Create a vendor and set the trade treasure of the vendor
# Add the treasure table to the vendor
+
# Add a dialog to the vendor
 
 
  
 
<br />
 
<br />
Line 28: Line 27:
 
[[File:CreateVendor_Step1_CreateTreasureTable.png|none]]
 
[[File:CreateVendor_Step1_CreateTreasureTable.png|none]]
 
<sub>Creating the treasure table stats entry</sub>
 
<sub>Creating the treasure table stats entry</sub>
 +
 +
First, we will create a new treasure table to assign to our vendor. Treasure tables are item tables used to define random loot.
 +
 +
 +
To create our treasure table, we:
 +
* Open the TreasureTable stats document in the [[File:StatsEditor_Icon.png|32px]] [[Stats editor]] (Create the document if it does not yet exist) <span style="color:#FCFF27">(1)</span>.
 +
* Create a new treasure table, I named mine "ST_SkillbookWaterBolt", and then set the following fields <span style="color:#FCFF27">(2)</span>:
 +
** DropCount (1,1): this defines the minumum and maximum amount of items generated from the treasure table.
 +
** ObjectCategory (I_SKILLBOOK_Air_WaterBolt): this is the name of our skillbook's stat object with "I_" prefixed to it.
 +
** Frequency (1): the likelyhood of SKILLBOOK_Air_WaterBolt being generated from the treasure table.
 +
* Save <span style="color:#FCFF27">(3)</span>.
 +
 +
<br />
 +
=== Step 2: Creating a vendor and setting the trade treasure ===
 +
For our vendor, we create a new template based on the GameMaster_Trader_Skill_NOTUSED root template in the [[File:RootTemplatePanel_Icon.png|32px]] [[Root template panel]].
  
 
<br />
 
<br />
=== Step 2: Creating a vendor ===
+
[[File:CreateVendor_Step1_CreateVendor_Step1_Copy.png|none]]
 +
<sub>Copying the GameMaster_Trader_Skill_NOTUSED root template</sub>
 +
 
 +
 
 +
First, open the root template panel <span style="color:#FCFF27">(1)</span>, find the GameMaster_Trader_Skill_NOTUSED template <span style="color:#FCFF27">(2)</span> and create a new template from it <span style="color:#FCFF27">(3)</span>.
  
 
<br />
 
<br />
=== Step 3: Adding the treasure table to the vendor ===
+
[[File:CreateVendor_Step1_CreateVendor_Step2_Setup.png|none]]
 +
<sub>Configuring the new root template</sub>
 +
 
 +
 
 +
Make sure to set the mod (project) <span style="color:#FCFF27">(1)</span> of the new root template and give it a new name <span style="color:#FCFF27">(2)</span>. I named my new root template MyTrader_WaterBolt.
 +
 
 +
We also need to edit the "Trade Treasure" property of the template <span style="color:#FCFF27">(3)</span>.
 +
 
 +
<br />
 +
[[File:CreateVendor_Step1_CreateVendor_Step2_AssignTradeTreasures.png|none]]
 +
<sub>Assigning the trade treasure to our new treasure table</sub>
 +
 
 +
 
 +
When the "Edit Treasure" dialog editor is open, remove the "TraderSkill" treasure table and add the treasure table we created in step 1 (ST_SkillbookWaterBolt in my case).
 +
 
 +
To assign our new treasure table:
 +
* Search the treasure table <span style="color:#FCFF27">(1)</span>
 +
* Select the treasure table <span style="color:#FCFF27">(2)</span>
 +
* Assign it with the ">>" buton <span style="color:#FCFF27">(3)</span>
 +
 
 +
 
 +
To remove an assigned treasure table:
 +
* Select the treasure table <span style="color:#FCFF27">(4)</span>
 +
* Unassign it with the "<<" button <span style="color:#FCFF27">(5)</span>
 +
 
 +
 
 +
Click "OK" <span style="color:#FCFF27">(6)</span> to close the edit treasure dialog and then press "Create" to finish creating the root template. Optionally move the root template to a different folder in the root template panel, and hit save.
 +
 
 +
<br />
 +
[[File:CreateVendor_Step1_CreateVendor_Step2_PlaceVendor.png|none]]
 +
<sub>Placing an instance of the vendor in our level</sub>
 +
 
 +
 
 +
Finally, we need to place our vendor in a level. To do this, find the new vendor's root template <span style="color:#FCFF27">(1)</span>, select it <span style="color:#FCFF27">(2)</span>, enable the creation interaction mode <span style="color:#FCFF27">(3)</span> and place an instance of the template in your level <span style="color:#FCFF27">(4)</span>.
 +
 
 +
<br />
 +
=== Step 3: Creating a dialog ===
 +
Although our vendor is all set up to trade with, the player can not yet initiate conversation. To do this, we first need to add a dialog.
 +
 
 +
To do this, we first need to open the [[File:DialogEditor_Icon.png|32px]] [[Dialog editor]].
 +
 
 +
<br />
 +
[[File:CreateVendor_Step2_CreateDialog_Step1_EditSpeakers.png|none]]
 +
<sub>The dialog editor with a new, empty dialog</sub>
 +
 
 +
 
 +
In the dialog editor, make sure you have a new, empty dialog open (Ctrl+N). We first need to assign the speakers to our dialog, for this dialog the only speaker will be our trader.
 +
 
 +
To assign speakers, first click "Edit" <span style="color:#FCFF27">(1)</span> next to Speakers in the top right of the dialog window.
 +
 
 +
<br />
 +
[[File:CreateVendor_Step2_CreateDialog_Step2_EditDialogSpeakers.png|none]]
 +
<sub>The edit dialog speakers dialog</sub>
 +
 
 +
 
 +
You will see the "Edit Dialog Speakers" dialog opens. In here, we will need to add a speaker <span style="color:#FCFF27">(1)</span> and then click the "Edit" button next to the speaker to assign a character <span style="color:#FCFF27">(2)</span>.
 +
 
 +
<br />
 +
[[File:CreateVendor_Step2_CreateDialog_Step3_AssignSpeakers.png|none]]
 +
<sub>The assign speakers dialog</sub>
 +
 
 +
 
 +
The assign speakers dialog allows us to assign a speaker. Our speaker will be our trader npc, which I named "MyTrader_WaterBolt".
 +
 
 +
To assign a speaker, first search for it in the "Available" speakers list <span style="color:#FCFF27">(1)</span>. Then, with the speaker selected, click the ">" button <span style="color:#FCFF27">(2)</span> to assign it.
 +
 
 +
With our speaker assigned, click "OK" <span style="color:#FCFF27">(3)</span> to close the assign speakers dialog, and again to close the edit dialog speakers dialog.
 +
 
 +
<br />
 +
[[File:CreateVendor_Step2_CreateDialog_Step4_AddGreeting.png|none]]
 +
<sub>Adding a greeting node</sub>
 +
 
 +
 
 +
With our speaker assigned we can add a greeting node to the dialog. To add a greeting, simply right click anywhere in the dialog overview, mouse over "Add Node" and click "Greeting".
 +
 
 +
<br />
 +
[[File:CreateVendor_Step2_CreateDialog_Step5_SetGreetingProperties.png|none]]
 +
<sub>Setting the properties of the dialog node</sub>
 +
 
 +
 
 +
Before we give the greeting node text we need to set up its properties. First, select the node <span style="color:#FCFF27">(1)</span>.
 +
 
 +
Then, with the node selected, assure the following properties are set correctly:
 +
* End Node <span style="color:#FCFF27">(2)</span>
 +
*: If the "End Node" property is toggled, the dialog will end after this node.
 +
* Speaker <span style="color:#FCFF27">(3)</span>
 +
*: The "Speaker" should be assigned correctly by default, but make sure it is set to our trader npc.
 +
* Stub <span style="color:#FCFF27">(4)</span>
 +
*: The "Stub" property is used to flag dialog nodes as work-in-progress nodes, which we do not care for.
 +
 
 +
 
 +
The last thing we need to do is set the text for our dialog. To open the dialog text editor, double click the node <span style="color:#FCFF27">(1)</span>.
 +
 
 +
<br />
 +
[[File:CreateVendor_Step2_CreateDialog_Step6_AddText.png|none]]
 +
<sub>The dialog node text editor</sub>
 +
 
 +
 
 +
In the dialog node text editor, click "Add" <span style="color:#FCFF27">(1)</span> to add a new text to the node and then type a greeting in the textbox <span style="color:#FCFF27">(2)</span>. I set the text to "Greetings, traveler!".
 +
 
 +
Once you have a text set up you can close the dialog node text editor.
 +
 
 +
<br />
 +
[[File:CreateVendor_Step2_CreateDialog_Step7_SaveAs.png|none]]
 +
<sub>Saving the dialog</sub>
 +
 
 +
 
 +
Finally, we need to save the dialog. Back in the dialog editor click "File > Save > Save As..." on the menu bar. You can save a dialog anywhere in "Data\Mods\<span style="color:#ede4da">{YourProjectFolder}</span>\Story\Dialogs" or subdirectory.
 +
 
 +
I named my dialog "DefaultGreeting". Note that the name of the file is important, as it is also the name used to identify the dialog.
 +
 
 +
<br />
 +
=== Step 4: Assigning the dialog to our vendor ===
 +
[[File:CreateVendor_Step2_CreateDialog_Step8_SetTraderDialog.png|none]]
 +
<sub>Assigning the "Default Dialog" property on a template</sub>
 +
 
 +
 
 +
To assign the dialog, select the vendor in the editor <span style="color:#FCFF27">(1)</span> and type the name of the dialog in the "Default Dialog" property <span style="color:#FCFF27">(2)</span>. I named the dialog "DefaultGreeting".
 +
 
 +
Our vendor is now all set up and ready to sell our skillbook!
 +
 
 +
<br />
 +
=== Step 5: Trading ===
 +
[[File:CreateVendor_Step3_Trade.png|none]]
 +
<sub>Trading with our vendor</sub>
 +
 
 +
 
 +
To test your vendor, go in-game, initiate the conversation with the vendor and click the trade icon in the top left.
 +
 
 +
If you followed all the steps in parts 2 through 4 of this guide, you should now see the skillbook in the vendor's stock, similar to the screenshot above.
  
 
<br />
 
<br />
Line 40: Line 187:
 
* The item was not generated out of that treasure table
 
* The item was not generated out of that treasure table
 
*: Items in treasure tables are randomly generated, if an item does not show up it might just be bad RNG!
 
*: Items in treasure tables are randomly generated, if an item does not show up it might just be bad RNG!
 +
* Your skillbook stats entry does not have the correct root template id
 
* The "Story Item" flag is checked in the skillbook properties
 
* The "Story Item" flag is checked in the skillbook properties
  
 
<br />
 
<br />

Latest revision as of 11:09, 2 October 2017

This article is part of a 4-part series on how to create, edit and use a new skill.

Part 1: creating a new skill
Part 2: creating a skill from existing
Part 3: creating and using a skillbook
Part 4: adding the skillbook to a vendor

The data used in this article was created in parts 2 & 3 of the series.


Description

Vendors are NPC characters that buy or sell items. In order to assign our skillbook to a vendor npc, we will need to do a couple of things:

  1. Create a treasure table
  2. Create a vendor and set the trade treasure of the vendor
  3. Add a dialog to the vendor


Setting up a vendor

Step 1: Creating a treasure table

CreateVendor Step1 CreateTreasureTable.png

Creating the treasure table stats entry

First, we will create a new treasure table to assign to our vendor. Treasure tables are item tables used to define random loot.


To create our treasure table, we:

  • Open the TreasureTable stats document in the StatsEditor Icon.png Stats editor (Create the document if it does not yet exist) (1).
  • Create a new treasure table, I named mine "ST_SkillbookWaterBolt", and then set the following fields (2):
    • DropCount (1,1): this defines the minumum and maximum amount of items generated from the treasure table.
    • ObjectCategory (I_SKILLBOOK_Air_WaterBolt): this is the name of our skillbook's stat object with "I_" prefixed to it.
    • Frequency (1): the likelyhood of SKILLBOOK_Air_WaterBolt being generated from the treasure table.
  • Save (3).


Step 2: Creating a vendor and setting the trade treasure

For our vendor, we create a new template based on the GameMaster_Trader_Skill_NOTUSED root template in the RootTemplatePanel Icon.png Root template panel.


CreateVendor Step1 CreateVendor Step1 Copy.png

Copying the GameMaster_Trader_Skill_NOTUSED root template


First, open the root template panel (1), find the GameMaster_Trader_Skill_NOTUSED template (2) and create a new template from it (3).


CreateVendor Step1 CreateVendor Step2 Setup.png

Configuring the new root template


Make sure to set the mod (project) (1) of the new root template and give it a new name (2). I named my new root template MyTrader_WaterBolt.

We also need to edit the "Trade Treasure" property of the template (3).


CreateVendor Step1 CreateVendor Step2 AssignTradeTreasures.png

Assigning the trade treasure to our new treasure table


When the "Edit Treasure" dialog editor is open, remove the "TraderSkill" treasure table and add the treasure table we created in step 1 (ST_SkillbookWaterBolt in my case).

To assign our new treasure table:

  • Search the treasure table (1)
  • Select the treasure table (2)
  • Assign it with the ">>" buton (3)


To remove an assigned treasure table:

  • Select the treasure table (4)
  • Unassign it with the "<<" button (5)


Click "OK" (6) to close the edit treasure dialog and then press "Create" to finish creating the root template. Optionally move the root template to a different folder in the root template panel, and hit save.


CreateVendor Step1 CreateVendor Step2 PlaceVendor.png

Placing an instance of the vendor in our level


Finally, we need to place our vendor in a level. To do this, find the new vendor's root template (1), select it (2), enable the creation interaction mode (3) and place an instance of the template in your level (4).


Step 3: Creating a dialog

Although our vendor is all set up to trade with, the player can not yet initiate conversation. To do this, we first need to add a dialog.

To do this, we first need to open the DialogEditor Icon.png Dialog editor.


CreateVendor Step2 CreateDialog Step1 EditSpeakers.png

The dialog editor with a new, empty dialog


In the dialog editor, make sure you have a new, empty dialog open (Ctrl+N). We first need to assign the speakers to our dialog, for this dialog the only speaker will be our trader.

To assign speakers, first click "Edit" (1) next to Speakers in the top right of the dialog window.


CreateVendor Step2 CreateDialog Step2 EditDialogSpeakers.png

The edit dialog speakers dialog


You will see the "Edit Dialog Speakers" dialog opens. In here, we will need to add a speaker (1) and then click the "Edit" button next to the speaker to assign a character (2).


CreateVendor Step2 CreateDialog Step3 AssignSpeakers.png

The assign speakers dialog


The assign speakers dialog allows us to assign a speaker. Our speaker will be our trader npc, which I named "MyTrader_WaterBolt".

To assign a speaker, first search for it in the "Available" speakers list (1). Then, with the speaker selected, click the ">" button (2) to assign it.

With our speaker assigned, click "OK" (3) to close the assign speakers dialog, and again to close the edit dialog speakers dialog.


CreateVendor Step2 CreateDialog Step4 AddGreeting.png

Adding a greeting node


With our speaker assigned we can add a greeting node to the dialog. To add a greeting, simply right click anywhere in the dialog overview, mouse over "Add Node" and click "Greeting".


CreateVendor Step2 CreateDialog Step5 SetGreetingProperties.png

Setting the properties of the dialog node


Before we give the greeting node text we need to set up its properties. First, select the node (1).

Then, with the node selected, assure the following properties are set correctly:

  • End Node (2)
    If the "End Node" property is toggled, the dialog will end after this node.
  • Speaker (3)
    The "Speaker" should be assigned correctly by default, but make sure it is set to our trader npc.
  • Stub (4)
    The "Stub" property is used to flag dialog nodes as work-in-progress nodes, which we do not care for.


The last thing we need to do is set the text for our dialog. To open the dialog text editor, double click the node (1).


CreateVendor Step2 CreateDialog Step6 AddText.png

The dialog node text editor


In the dialog node text editor, click "Add" (1) to add a new text to the node and then type a greeting in the textbox (2). I set the text to "Greetings, traveler!".

Once you have a text set up you can close the dialog node text editor.


CreateVendor Step2 CreateDialog Step7 SaveAs.png

Saving the dialog


Finally, we need to save the dialog. Back in the dialog editor click "File > Save > Save As..." on the menu bar. You can save a dialog anywhere in "Data\Mods\{YourProjectFolder}\Story\Dialogs" or subdirectory.

I named my dialog "DefaultGreeting". Note that the name of the file is important, as it is also the name used to identify the dialog.


Step 4: Assigning the dialog to our vendor

CreateVendor Step2 CreateDialog Step8 SetTraderDialog.png

Assigning the "Default Dialog" property on a template


To assign the dialog, select the vendor in the editor (1) and type the name of the dialog in the "Default Dialog" property (2). I named the dialog "DefaultGreeting".

Our vendor is now all set up and ready to sell our skillbook!


Step 5: Trading

CreateVendor Step3 Trade.png

Trading with our vendor


To test your vendor, go in-game, initiate the conversation with the vendor and click the trade icon in the top left.

If you followed all the steps in parts 2 through 4 of this guide, you should now see the skillbook in the vendor's stock, similar to the screenshot above.


Troubleshooting

Several things can cause a skillbook to not show up on a vendor's sell list:

  • The item was not generated out of that treasure table
    Items in treasure tables are randomly generated, if an item does not show up it might just be bad RNG!
  • Your skillbook stats entry does not have the correct root template id
  • The "Story Item" flag is checked in the skillbook properties