Custom NPC Tutorial: Difference between revisions

From Bonfire by Hogswild Prasetto
bonfire-wiki>Sonic260
bonfire-wiki>Sonic260
mNo edit summary
Line 72: Line 72:
* '''Green - Choices / Conditionals. '''"TextAndChoice" or "Conditional" types change the flow of the conversation, either when the user selects a response from a choice menu, or if a certain condition is met. When done properly, they can be used to create complex quests and conversations. This type is relies on the parent box's "type" setting to exist. In order to create them, the parent must be of type "TextAndChoice" or "Conditional." Afterward, any new children will be green to represent a dialogue choice, or a line that will execute under a certain condition. Because the Parent-Child relationship is necessary to create these, '''this means the root of the dialog tree, Line 0, ''cannot '' be used as a choice or condition.'''  
* '''Green - Choices / Conditionals. '''"TextAndChoice" or "Conditional" types change the flow of the conversation, either when the user selects a response from a choice menu, or if a certain condition is met. When done properly, they can be used to create complex quests and conversations. This type is relies on the parent box's "type" setting to exist. In order to create them, the parent must be of type "TextAndChoice" or "Conditional." Afterward, any new children will be green to represent a dialogue choice, or a line that will execute under a certain condition. Because the Parent-Child relationship is necessary to create these, '''this means the root of the dialog tree, Line 0, ''cannot '' be used as a choice or condition.'''  
* '''Red - "Inactive" box. '''This occurs when a "SimpleText" parent has more than one child. The dialogue will flow to the first child naturally and ignore the "inactive" children. In order to reach the "Inactive" blocks, rather than creating a New Line, you can also click the box to "Derive to existing line," and enter the line number you want the conversation to jump to. There's an example of how to pull this off later.
* '''Red - "Inactive" box. '''This occurs when a "SimpleText" parent has more than one child. The dialogue will flow to the first child naturally and ignore the "inactive" children. In order to reach the "Inactive" blocks, rather than creating a New Line, you can also click the box to "Derive to existing line," and enter the line number you want the conversation to jump to. There's an example of how to pull this off later.
 
<nowiki/>[[File:SimpleText.png|thumb|270x270px]]
===<nowiki/>===
[[File:SimpleText.png|thumb|270x270px]]


=== Anatomy of the "SimpleText" box ===
=== Anatomy of the "SimpleText" box ===

Revision as of 00:11, 3 June 2019

Welcome! In this tutorial we will learn how to use Bonfire's built-in Character Editor to create Custom NPCs. First, we'll explore how to design your NPC's appearance and place them in the world, then we'll give them basic dialogue and enable them to speak to the player. Afterward, we'll learn how to create branching dialogue and Custom Actions to interact with our NPC. We'll enable our NPC to "remember" the player, and lastly we'll wrap up the lesson with a simple fetch quest.

At the end of each section, a sample Orc will be provided to demonstrate what we learned.

Setup

Before we begin, it's recommended that you have some familiarity with the Command Console as we'll be using a couple of them in this tutorial. You don't need to remember everything, but knowing some of the Basic or Debugging commands like save or rel will be useful.

The NPC Editor can be accessed from Bonfire's Main Menu. From the title screen, click Mods, then Character Editor.

Interface Overview

  1. File Menu - Save your NPC; Load Existing NPCs; Import one of your profiles to use as a Custom NPC; rename the file.
  2. Character Profile - Give your NPC a name, and manage their inventory by clicking the '+' icon
  3. Attributes - This will apply a default "state" for your NPC when they load in the scene.
  4. Location - Sets your NPCs coordinates and the scene (or level) that they will appear in
  5. Metadata - Holds data about the Mod creator and a description of the NPC. Please fill this out if you intend to share your NPCs with other players.
  6. Character Dialogue - This space holds the entire conversation
  7. Navigation - "Tiny View" allows you to collapse the entire dialogue tree so it's easier to traverse. The Jump field lets you move to a specific line number.
  8. Exit - Exits the character editor and reloads the current scene.

Section 1 - Creating the NPC

First, we'll need an Orc to import into the Character Editor. A NPC's appearance is generated by importing one of your pre-existing profiles. So we have the option of either creating a brand new profile, or, if you would rather use your own Orc as an NPC, you can skip ahead to Step 2.

  1. Create a brand new profile, or load an existing one
    • From Bonfire's Main Menu, click Profiles, then click Create New. Spend as much time as you want designing your NPC's appearance, and be sure to give them a name. When you're finished, click Enter to save your Profile and exit the character creation.
  2. Set your NPC's spawn point
    • Decide where you want your NPC to spawn in the world. Do you want them to show up in the Outback? Occupy the Inn? Lounge at the island? Etc.
    • For this tutorial, we'll spawn our NPC on the Island. Load up one of your profiles, open the console with F1, and then type:
      • travel Sea1
    • This will instantly warp you to the Island. Next, find a good location to spawn your NPC. When you're ready, open the console again and type:
      • refpos
    • refpos will save your character's current X, Y, and Z coordinates into the console.
  3. Import the character
    • We're now ready to create our NPC. Return to the character editor by opening the Main Menu, then click Mods then Character Editor. Alternatively you can open the console and type:
      • chedit
    • Click the "Import Character" button and find the Orc you created in Step 1, or import one of your pre-existing characters. You'll see that your Orc's name will appear within the Character Attributes section.
  4. Manage your NPC's Inventory
    • Expand the Items... field by clicking the " + " button next to it. This section will let you control your NPC's inventory, including their clothing. By default, new Orcs will only contain a leather Loincloth, but if you imported one of your profiles, you may see all the items you collected in-game.
    • Click New Item to add an inventory slot. Click Change to select a new item from the list. Click Remove to delete inventory slots.
    • Check in Wear this item to make your Orc equip this when they spawn.
  5. Set your NPC's attributes (Optional)
    • This section is used to apply a default "state" for your NPC when they load in the scene. For example, you could have them execute a console command, or prevent them from spawning unless the player is at a certain point within Bonfire's story. This isn't necessary for our purposes, so we will skip this part.
  6. Set the location
    • This is where we'll use the coordinates we saved in Step 2. In the Scene field, click "World1" and select "Sea1."
    • In the Position field, select "Paste from Console," and the X, Y and Z fields will populate the coordinates from the refpos command.
  7. Write the Metadata
    • Use the text boxes to sign your name as the author of this NPC, and write a brief description of this NPC. This is recommended if you intend to share your NPC with other players.
  8. Character Dialogue - Hello World
    • In the Speech section of the dialogue box, type the following message:
      • Hello @playername, my name is @playerinterest. Congrats on creating your first NPC!
    • Don't worry if you don't know what the rest of the buttons and fields in the dialogue box are for. In the next section we'll go over the functions of a dialogue box, and learn how to create basic dialog.
  9. Save your NPC and exit the Character Editor.
    • When you're finished, click the "Save" button, and this will save your NPC as a .bab file located at:
      • C:\Users\%userprofile%\AppData\LocalLow\Prasetto\Bonfire\Mods\Characters
    • Click the "Exit" button. This will immediately reload the game, and place you back at the entrance to the island.
  10. Enable your NPC
    • When the scene reloads, you'll immediately notice that your NPC hasn't spawned in the world yet! That's because we'll need to enable them.
    • From Bonfire's Main Menu, open Mods then Mod Manager. You'll see the list of modes you have installed currently. Find the name of the NPC you just created, and click the check mark.
    • Click "Done" and the scene will reload again. Back at the Island's entrance, you should see our newly created NPC. Go speak to them, and they will speak the "Hello" dialogue we gave them.
  11. Link to Section 1 Sample: []

Section 2 - Basic Dialogue

Well done on creating your first NPC! Now that they have a presence in the world, next we'll give them a voice and learn how to create basic dialogue.

Dialogue in Bonfire is made by creating several objects, called "Dialogue Boxes" and linking them together in a series. When you speak to the NPC, they will read the Speech field in first box (usually Line 0) then read the rest of the Dialogue Boxes in the order they appear.

Dialogue boxes follow a "Parent-Child" relationship. A dialogue box with another box nested under is called the "Parent," while the nested box is the "Child." If the "Child" has other children, then it becomes "Parent" to those children, and so on.

Dialogue Box Colors

Dialogue Boxes come in three colors, each representing its purpose within the editor:

  • Black - Normal Dialogue Box, or "SimpleText" box. This is the default type. The conversation will flow from the parent box to the child box until the branch ends. A parent box of the "SimpleText" type is allowed to have multiple children, however, the conversation will only flow to the first child that was created. Any additional children created will appear as a red box marking them as "inactive" lines of dialog. This means they won't appear in the conversation normally, and will require additional setup to be reached.
  • Green - Choices / Conditionals. "TextAndChoice" or "Conditional" types change the flow of the conversation, either when the user selects a response from a choice menu, or if a certain condition is met. When done properly, they can be used to create complex quests and conversations. This type is relies on the parent box's "type" setting to exist. In order to create them, the parent must be of type "TextAndChoice" or "Conditional." Afterward, any new children will be green to represent a dialogue choice, or a line that will execute under a certain condition. Because the Parent-Child relationship is necessary to create these, this means the root of the dialog tree, Line 0, cannot be used as a choice or condition.
  • Red - "Inactive" box. This occurs when a "SimpleText" parent has more than one child. The dialogue will flow to the first child naturally and ignore the "inactive" children. In order to reach the "Inactive" blocks, rather than creating a New Line, you can also click the box to "Derive to existing line," and enter the line number you want the conversation to jump to. There's an example of how to pull this off later.

Anatomy of the "SimpleText" box

  • Line Number
    • This is a dialogue box's ID number, but it DOES NOT represent the order in which the lines are spoken. For example, the typical order of a conversation is "0 > 1 > 2 > 3 > 4 > " and so on, but it's possible to re-order the lines of dialog and have the order as "0 > 4 > 1 > 2 > 3 > " .
    • In addition, when adding or removing dialogue boxes, Bonfire will start from the highest available line number, and continue from there, even if there are gaps in progression. For example, if you start with an order like this:
      • 1 > 2 > 3 > 4 > 5
    • But then remove lines 2, 3, and 4, any new lines created will continue from 5 onward:
      • 1 > 5 > 6 > 7 > 8
    • While speaking to an NPC, you can keep track of which lines are spoken by using the console command: showdiagindex. When you speak to your NPC, you'll see number at the beginning of every sentence, representing the line number.
  • Character Starring
    • This represents the speaker, and it also defines the default target when any Custom Actions are activated. For example, if there's an action that starts a growth buff, then "Person2" will receive the effect. If there's an action to start sex, then "Person2" will take the top position.
    • Lastly, "Person2" represents the NPC, while "Player" represents the player
  • Dialogue type
    • This is set on the Parent to determine the child box's Type.
    • SimpleText - Creates a black dialogue box that represents the normal flow of a conversation
    • TextAndChoice - Causes this line to display a text menu, where the player can select subsequent lines as dialog options.
    • Conditional - A line of dialog that will only execute when a specific condition is met (ex: Is the player cursed; are they holding a certain item; is the NPC at a certain height range, etc.)
  • Text Display
    • This is how the text will appear when the line is spoken
    • Custom - Will print out whatever is written in the Speech field as normal.
    • Generated Orskera - Will randomly generate Orcish language, disregarding the Speech field
    • Invisible - The text box will not appear at all, and the camera look at the speaker. Useful for apply facial expression or running other actions.
  • Speech
    • The spoken line of dialogue, if the Text Display is set to "Custom."You can use parameters like @playername or @playerinterest in the place of the participants' names.
  • "Start from here" - Deprecated as of 0.31
    • Acts as a marker for where the dialogue will pick up if the conversation ends for any reason. However, this field is buggy. Excessive use can cause this NPC's conversation to leak into other NPCs, overwriting their speech. Furthermore, if you teleport to a different scene, this placeholder is lost, and the player will have to start the conversation from the very beginning.
    • As of version 0.31, this has been deprecated, and will no longer work. To make NPC's remember conversations, we now need to use Item Flags, as will be explained in the Conditionals Section.
  • Custom Actions
    • These are actions that are performed when this line is reached. Custom Actions have numerous uses. They can be used to execute console commands during the conversation, and they can also initiate buffs, start sex, warp the player or NPC to different scenes, etc...
    • Start Actions - These are actions that will activate the moment the speaker opens their mouth.
    • End actions - These are actions that will execute just before the next line, when the player clicks the mouse button to continue the conversation.
  • Remove
    • Delete a full branch of dialog. If used on a parent with children, all of the children and their children will be deleted along with the parent.
  • Derive to existing line
    • Sends control of the conversation to a different line of dialogue that might not be a direct child of this box. A common use is to access red dialogue boxes marked as "inactive"
  • New Followup line
    • Creates a new child dialogue box. The type is dependent on the parent's "Dialogue Type" setting.
  • Set
    • This is used to re-order lines of dialog. When clicked, the current dialog box and all of its descendants will move underneath the line specified.
    • Note: This field will not appear on Line 0.

Dialogue Example

Now lets give our NPC a voice. In this section we'll create a basic conversation. We'll also introduce @playername and @playerinterest as placeholders for our Orcs' names.