Custom NPC Tutorial: Difference between revisions
bonfire-wiki>Sonic260 →Anatomy of a Conditional Box: Emergency Save |
bonfire-wiki>Sonic260 →Section 5 - Conditionals: Adds and complete's Section 5's lesson, where we implement data flags to allow the NPC to remember the player's progress. |
||
| Line 614: | Line 614: | ||
Now lets jump to Line 46 (not the newly created Line 47) | Now lets jump to Line 46 (not the newly created Line 47) | ||
[[File:Conditional - 46.png|thumb|347x347px]] | |||
Line 46 | Line 46 | ||
| Line 667: | Line 668: | ||
Save and speak to your NPC. If everything was done correctly, you shouldn't notice anything different. Your NPC will speak to you and present the choice menu as normal. However there will be a subtle change. Open the console with the F1 key and enter the '''showhiddenitems''' command. This will show you all the hidden fields and values Bonfire uses to manage its characters. Scroll to the bottom of your inventory, and you should see a blue icon with a giant "S." If you hover over this you'll see: | Save and speak to your NPC. If everything was done correctly, you shouldn't notice anything different. Your NPC will speak to you and present the choice menu as normal. However there will be a subtle change. Open the console with the F1 key and enter the '''showhiddenitems''' command. This will show you all the hidden fields and values Bonfire uses to manage its characters. Scroll to the bottom of your inventory, and you should see a blue icon with a giant "S." If you hover over this you'll see: | ||
[[File:Conditional - ItemFlag.png|thumb|220x220px]] | [[File:Conditional - ItemFlag.png|thumb|220x220px]] | ||
<blockquote>ITEM FLAG</blockquote><blockquote>NAME: MYNPC_FLG</blockquote><blockquote>DATA: 0</blockquote> | <blockquote>ITEM FLAG</blockquote><blockquote>NAME: MYNPC_FLG</blockquote><blockquote>DATA: 0</blockquote>Our NPC gave us the ItemFlag we created earlier! Now that we know how this works, we can tweak our conversation a little more. Go back into the NPC Editior, and jump to Line 14. | ||
Line 14 | |||
* Change Speech to: | |||
** ''Welcome back @playername, What do you want to do?'' | |||
* In the "Set" field, change the value to '''49''' and click "Set." All the choices we created will move under line '''49'''. | |||
Line 8 | |||
* Change Speech to: | |||
** ''Now we'll learn about Conditionals. If you followed the tutorial up to this point, you'll notice that you now have an ItemFlag called "myNPC_flg" within your inventory.'' | |||
Line 9 | |||
* Change Speech to: | |||
** ''Right now it's set to 0. I'm going to set it to 1, and this will make me skip this introduction every time we speak. I'll end the converssation here, but talk to me agin when you're ready.'' | |||
* End Action | |||
** SetFlag | |||
*** Flag ID name: '''myNPC_flg''' | |||
*** Flag content: '''1''' | |||
*** ...or instead apply to: '''@playername''' | |||
Save your NPC and speak to them again. After the first conversation ends, speak to them ''again'' and instead of the introduction, you'll be presented with the dialogue options right away. Every time you speak with your NPC, you'll always be presented with this dialogue option. | |||
Next, open the console with F1 and enter the '''save''' command to save your progress at this point. Close Bonfire, re-open it, and com back to speak to your NPC. Instead of the usual greeting, they'll jump right to the dialogue options. | |||
With this, you've created an NPC that remembers you! By setting up ItemFlags, you're giving NPCs a point of reference to start up different conversations. This enables you to create multi-part quest lines with different objects. | |||
It is possible to clear the NPC's memory and start over, however. If you use the '''dory''' command, or speak to [[Kult]], they will clear our all ItemFlags and other NPC information from your inventory. This isn't recommended on your main Orc, because it essentially resets your quest progress for the whole game. Use it wisely. | |||
A sample Orc, Demonstrating Section 5's concepts is available here: '''[]''' | |||
== Section 6 - Fetch Quest Example == | |||
Now that we have the basics of Conditionals down and created our NPC's memory, let's make a simple fetch quest that asks the player to collect coconuts around the island. We'll first create a new dialogue choice to support this. Go back to the NPC editor and load your NPC. | |||
Revision as of 14:33, 11 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

- File Menu - Save your NPC; Load Existing NPCs; Import one of your profiles to use as a Custom NPC; rename the file.
- Character Profile - Give your NPC a name, and manage their inventory by clicking the '+' icon
- Attributes - This will apply a default "state" for your NPC when they load in the scene.
- Location - Sets your NPCs coordinates and the scene (or level) that they will appear in
- 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.
- Character Dialogue - This space holds the entire conversation
- 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.
- 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.
- 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.
- 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.
- 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.
- 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:
- 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.
- 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.
- 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.
- 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.
- 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.
- In the Speech section of the dialogue box, type the following message:
- 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.
- When you're finished, click the "Save" button, and this will save your NPC as a .bab file located at:
- 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.
- 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 dialogue 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 dialogue 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 dialogue options.
- Conditional - A line of dialogue 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 continue if the conversation ended 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 dialogue 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 example we'll learn how to create a basic conversation. We'll introduce how to use @playername and @playerinterest as place holders for each participant's name. Next, we'll play with the order of the dialogue boxes to demonstrate how the conversation flows from one line to the next.
This section and the rest of the tutorial are heavily focused on using line numbers as a guide. As such, it's recommended that you try to follow the tutorial as best as you can and only create new lines when asked.

- Line 0
- Clear out the text we created in the last section
- Add the following text to the Speech field:
- Hello @playername! Welcome to Part 2 of the Bonfire Dialogue tutorial!
- Click "New followup line" to create a new child dialogue box.
- Line 1
- Set "Character starring" to "Player." This will make your character speak this line.
- By default the Type of this dialogue box is "SimpleText" and the Text Display is "Custom"
- Add the following to text to the Speech field:
- Thanks, @playerinterest! What are we doing this time?
- Click "New followup line" to create another dialogue box. From this point onward, I'll shorten this step as "New Line."
- Set "Character starring" to "Player." This will make your character speak this line.
- Line 2
- By default "Character starring" is always set to "Person2"
- Set the Speech:
- Right now we're trying to get your feet wet it building basic dialog.
- New Line
- Line 3
- Keep the "Character Starring" value as "Person2." As you can see, we don't need to alternate between the player and NPC for every line.
- Speech:
- Okay, now we'll end the conversation here.
Click "Save" to save your NPC, and click "Exit" to reload the scene. Find your NPC and speak to them. You'll see the conversation we just wrote, the camera will flip to show your character once, and the conversation will end at the fourth (numberOfLine - 1) line.
Now we'll play with the line order a little. Go back into the character editor and load your NPC to make the following changes. Use the "Jump" or "Tiny view" buttons to quickly navigate to the appropriate lines.
- Line 3
- Replace Speech with:
- This is actually line 3...
- New Line
- Replace Speech with:
- Line 4
- Speech:
- I've moved this line out of order. This is actually line 4!
- New Line
- Speech:
- Line 5
- Speech:
- This is line 5. The conversation is back in numerical order from this point on.
- New Line
- Speech:
- Line 6
- Set "Character Starring" to Player"
- Speech:
- Alright, I'll end this conversation now.
Don't save just yet. Either scroll up to Line 4, or type "4" in the "Jump to Entry number:" field, and click "Jump." This will move the dialogue interface to Line 4.

- Line 4
- In the "Set" field, change the value from 0 to 2, and click "Set." This will move line 4 under line 2 instead of line 3.
- However, moving line 4 under line 2 causes both line 3 and line 4 to be direct children of line 2. Because line 2 is marked as a "SimpleText" block, the conversation will only flow to the first child created under it, in this case, line 3. This means any more children created under line 2 will be marked as "inactive." If you were to speak to your NPC again, the conversation would flow as:
- Line 0 > Line 2 > Line 3 > Line 4 > end. Line 4 is unreachable in this state, and thus is never spoken. To remedy this, we'll change the order around once more.
- Line 3
- In the "Set" field, change the value from 0 to 4, and click "Set"
- Line 3 is now a child of Line 4... but wait! Because line 5 was the first child of line 4, line 3 is marked as inactive. We'll fix this once and for all next.
- Line 5
- Change the "Set" value from 0 to 3, and click "Set." Line 5 now becomes a child of line 3. As a bonus, line 6 moved with.
Phew! With that done, the new order of the conversation is:
- Line 0 > 1 > 2 > 4 > 3 > 5 > 6
Save your NPC, exit the editor, and speak to them again. The conversation will follow the new order we created. To check the line numbers while the conversation is in progress, open the command console and use the showdiagindex command. This will place a number before each sentence to show the line index.
Next we're going to add an "Inactive" line on purpose, and show you how to access them. Return to the Character Editor and and load our NPC once more. Go to line 0.

Line 0
- Click "New followup line"
Scroll all the way down to the bottom, and you'll see the newly created line 7, but it's in an "inactive state." As mentioned before, if we leave it like this, the conversation will never reach line 7 naturally. However, there's a way to access this that doesn't involve re-ordering the conversation. Jump to line 6:
Line 6
- Set "Character Starring" back to "Person 2"
- Speech
- Now we'll deal with "inactive" dialog..."
- Instead of "New followup line," click "Derive to existing line," and change the value from 0 to 7
Line 7
- Speech
- This is LIne 7. It's still in an "inactive" state, but we can reach this line thanks to the "Derive to existing line" box we created.
- Click "New followup line"
Line 8
- Set "Character starring" to "Player"
- Speech
- Nice!
Save and speak to your NPC. Again, use the showdiagindex command to show line numbers during the conversation. Notice how, even though Line 7 was "inactive," the conversation still moved on to Line 8. That's because whichever line is given control, the conversation will continue down that branch of dialogue until either it ends, or passes control through choices, conditions, or deriving to another line.
This concludes Section 2 of the Custom NPC tutorial. A sample orc of this section is available here: []
Section 3 - Adding Dialogue Choices
Now that we know how to create basic dialogue, it's time to make our conversation branch out a little bit with dialogue choices! These are moments in the conversation where the player is presented with a menu of responses. When the player clicks a response, the conversation will continue and play that branch of dialogue until it's conclusion. This enables you to create in-depth conversations with your NPCs with multiple outcomes (see Bolt Sunder), or create a simple menu for sex.
Anatomy of a Choice Box
To create a Choice Box, simply change the Type of the Dialogue Box to "TextAndChoice." But wait a second, the box is still black! This is because the TextAndChoice type requires the parent and its children to work together to form a text menu. The parent creates the context, giving the player a question or phrase at which they must respond, while each child serves as one of the responses.
If you click "New followup line," the newly created dialogue box will be green rather than the usual black. You also might notice that it's type is "SimpleText" rather than "TextAndChoice." This is because the "Type" of the dialogue box really indicates the behavior of its children, and not the box itself. If you were to set this box to "TextAndChoice," this would just make the speaker open a new menu when the player clicks this response.
When the parent's line of dialogue is spoken, the game will print out several options as responses, each representing a child box:

Choice boxes are nearly identical to the SimpleText box, with a few differences:

- Line Number - "Line" now has "(as choice)," placed next to it, indicating this will show up as a response for the parent.
- Choice representing this line - This is how the response will appear on the menu (See the image above). It's recommended to keep these short and concise.
- Speech - This is the actual dialogue that will be spoken, either by the NPC or the Player, only after this response has been chosen.
Choice Example
Open up the NPC we worked on in Section 2, and go to Line 7.
Line 7
- Character Starring is the Player
- Replace the Speech:
- Alright, so now that we have basic dialogue and an understanding of how the dialogue is order, what else can we do?
Line 8
- Character Starring is "Person2"
- Replace the Speech:
- Now we'll move on to Part 3 of the tutorial: choices.
- New Line
Line 9
- Change Type to "TextAndChoice"
- Speech:
- During sexy time, would you rather be on the giving end or receiving end?
- Press "New followup line" TWO times.
Lines 10 and 11 will both appear as direct children of line 9. You'll notice immediately that even though they're both children of line 9, neither of them have turned red. Green boxes signify dialogue that activates only after a certain condition has been met. In this case, the condition is if the player clicks one of them as a response. Since whether or not they appear is up to the player, they're both considered "active" lines of dialogue.

Line 10
- Character Starring is the Player
- Speech:
- I'd rather be the one on the "giving" end
- In the "Choice representing this line" field, change the text to: "Giving"
- Click "New followup line" to create your NPC's response.
Since line 10 is marked as "SimpleText," the next box will be black instead of green. You'll also notice that this new line starts with 12. Once again, the index for newly created line will always come after the highest available index, which was 11 previously. From this point on, the line ordering will get weird. That's why it's highly recommended you follow the tutorial as closely as possible, to avoid confusion.
Line 12
- Speech:
- Then I guess that makes you a top, right?
LIne 11
- Character Starring is the Player
- Speech:
- I like being on the receiving end!
- Choice representing this line: Receiving
- New Line
(The newly created line index is 13, since 12 was the previous highest.)
Line 13
- Speech:
- Then I guess that makes you a bottom.
Save and go speak to your NPC. When line Line 9 is reached, two responses will appear under the NPC's speech. These are the dialogue choices we created, representing Line 10 and Line 11. If you click on one of them, your character will say whatever was written to the "Speech" field, and the conversation will continue from that branch.
This concludes Section 3 of the Custom NPC tutorial. A sample orc of this section is available here: []
...What? You were expecting actual sex? Don't worry, we'll get to that in the next section.
Section 4 - Custom Actions
Now we'll add a little flair to our conversation using Custom Actions. Actions have a variety of uses. They can be used to initiate sex, Fuse with the orc you're conversing with, apply facial expressions, call console commands, and much more!
All dialogue boxes contain fields for "Start Actions" and "End Actions." Start Actions are applied the moment the speaker opens their mouth. End Actions are applied when the player clicks their mouse to start the next line. Dialogue boxes can contain multiple actions.
Check the Custom Actions page for the list of available actions, and their function.
Actions Example
First, let's remove some unnecessary dialogue.
Line 1
- Click "Remove"
"Remove" will delete Line 1 and all of its descendants down to Line 6. Be mindful when using this button, as you can potentially delete an entire branch of dialogue unintentionally. If you want to remove a single line within a branch, it's best to re-order the conversation with "Set" to isolate that line first before removing.
Since Line 1 is gone, Line 7 can move in to be the first child of Line 0. This causes the box to become black, no longer marking it as "inactive." Now we'll replace the text we created thus far.

Line 0
- Speech:
- Hello @playername! Welcome to Part 4 of the Bonfire Dialogue tutorial!
- Press the "+" button next to "0 custom actions" to reveal the Start and End Action fields.
- Start Action:
- Click "New Action" and by default a new "CustomCall" action is created by default.
- Click the "CustomCall" button to show the list of available actions.
- Find and click "Expression"
- The Default Expression is "Neutral." Click this, and find "Happy."
- In the "Sec" field, change the value to 10.
- The "Apply to" field can be left blank. The default behavior for Actions is to affect whomever the Starring character is. In this case, it's Person2, our NPC. However, we can change this behavior by writing our target's name, and they will have the facial expression applied to them instead, even if it's an NPC not a part of this conversation!
Line 7
- Speech:
- We've got basic dialogue and choice. What's next?
Line 8
- Speech:
- Now we'll learn how to create Custom Actions. If you were paying attention you'd noticed how I smiled at you when you first greeted me.
Line 9
- Set Type back to "SimpleText"
- Speech:
- But enough of that. Let's do something a bit more... practical.
- Start Actions
- Expression
- Pleased
- 10 Secs
- Expression
Line 10 and Line 11
- Remove both of these lines, and add a new line under Line 9.
Line 14
- Set Type to "TextAndChoice"
- Speech:
- What do you want to do?
- Click "New followup line" SIX times.
Lines 15 - 20
- In each new we created, set "Character Starring" to "Player."
Line 15
- Choice representing this line: Console Command
- Speech:
- Let's try out a console command
- New Line

Line 21
- Speech:
- Alright, so the command we're using is the "dwarve" command. This will change your target into a dwarf, like so!
- Start Actions
- Leave "CustomCall" the default
- In the "String Parameter" field, enter the following:
- dwarve @playerinterest,100,2,0
- New Line
Line 22
- Speech
- Next, I'll show you an End Action. I'll go back to my regular self, but this will only happen just after you click the mouse to start the next line.
- End Actions
- CustomCall:
- batch target @playerinterest;origins;targetclear
- CustomCall:
- New Line
Line 23
- Speech:
- Annnd done.
In Line 22's CustomCall we just added three console commands. First, the batch command allows us to string multiple commands in a single line, separated by a semicolon(;). We then target the NPC in front of us with target @playerinterest. Next, we restore our NPC's form with the origins command, and finally we return control of the console back to the player with targetclear.
All of this was added on one line thanks to the batch command, but it's perfectly legal to have multiple CustomCall actions within the same dialogue box. The command will run in the order they're created.
A Warning on Console Commands
Any time you use console commands in dialogue, it's extremely important that you use targetclear at the end to return control back to the player. This helps minimize conflict between other mod creators' NPCs, who might also use console commands for some task or another.
We're done with this branch. Save your NPC and go speak to them again. Select the Console Command option, and your NPC will run the command we just gave them. The other options don't do anything except make you speak a generic line, as we hadn't created those reponses yet.
Next, let's turn the menu into a loop, so whenever you pick an option, the dialog will come back to the menu, without having to view the introductory text every time.
Line 23
- Click "Derive to Existing Line" and set the value to 14.
Now when you select this option again, the dialogue will return to line 14, and your NPC will ask you to select the next response. Let's create an exit out of the conversation so you wont be stuck in an infinite loop. Jump to Line 20
Line 20
- Choice representing this line: Leave
- Speech
- That's enough for now, I'll see you later, @playerinterest
- New Line
Line 24
- Speech
- Alright see you.
You can test this if you want, but now let's go create the rest of the choices. Jump to Line 16.
Line 16
- Choice representing this line: Sex
- Speech
- Let's bang!
- New Line
Line 25
- Set Type to "Text and Choice"
- (You can nest menus within menus)
- Speech
- Heh, I was wondering when you were going to pick that. So... do you feel like topping or bottom?
- Click "New followup line" TWO times. This will create two choices.

Line 26
- Character Starring is the Player
- Choice representing this line: Top
- Speech
- I'll top this time. Turn around.
- End Actions
- Click "CustomCall" and find "QuickInteraction." These are the list of available sex positions.
- Leave the interaction type as "SexAnal1." This is Doggy style.
- Leave "Swap Role" blank. We'll use that next.
- Click "CustomCall" and find "QuickInteraction." These are the list of available sex positions.
- New Line
Line 28
- Speech
- Oof... that was awesome
- Derive to Existing Line: 14
- NOTE: When we test this, it's not going to work as expected. More on that later...
Line 27
- Character Starring is the Player
- Choice representing this line: Bottom
- Speech
- I wouldn't mind getting pounded.
- End Actions
- QuickInteraction
- Set Interaction Type to "SexAnal2." This is the Missionary style.
- Click "Swap Role." By default, whichever participant is selected in the "Character Starring" field will take the top's position. This will reverse that behavior, and make them bottom instead.
- QuickInteraction
- New Line
Line 29
- Speech
- How'd that feel?
- Derive to existing line: 14
- NOTE: again, this won't work as expected.
Save your NPC an test the new Sex option. You'll immediately notice that after either of you cum, the post-sex dialog we implemented will not play, and you won't be sent back to the dialog menu. Instead, the game's vanilla dialogue appears and the conversation ends.
Try this: Start choose the Sex option again, and press the ESC key to cancel the animation early. Now our post-sex dialog will play like it's supposed to. What's going on here? That's because dialogue works slightly differently when sex is involved. Don't worry about this for now. A section on how to implement Post-Sex dialogue has been included in Section 7.
Now let's return to the editor. To free up some space, go Line 15 and 16 and press the "-" symbol in the top right corner. This will collapse those branches of dialogue, making it easier to stay organized.
Line 17
- Choice representing this line: Buff
- Speech
- How about a Buff?
- New Line
Line 30
- Speech
- Alright, one buff coming right up!
- End Actions
- Add one CustomBuff
- Click "Sweat" and set Buff type to "HeightIncrease"
- Set "Sec" to 30
- Set "Repeats" to 15
- Add another CustomBuff
- Set Buff type to "HeightIncrease"
- Set "Sec" to 30
- Set "Repeats" to 5
- Check in the option to "Apply to other character"
- Add one CustomBuff
- New Line
In Line 30 we changed the Sec and Repeats fields to modify the strength and duration of the buff, respectively. "Sec" is the buff's duration, and can be any value between 0 and 1E+08. "Repeats" refers to how many units are added to that specific attribute while the buff is active. This can be any number between 1 and the attribute's max value (usually 100). For example, if the Repeats amount is 100, that attribute will instantly max out when the buff activates. If Repeats is 1, that attribute will fill out slowly.
The "Apply to other character" fields works the same way as the QuickInteraction Action. By default, buffs will only affect whomever is selected in the Character Starring field. If you check this in, you'll affect the other participant in the conversation instead.
Line 31
- Speech
- And here we go! I applied a HeightIncrease buff to both of us. If neither of us are at the max height already, I should be growing rather quickly, while you should grow at a snail's pace.
- New Line
Line 32
- Character Starring is the Player
- Text display is "Invisible" - This will cause the camera to show your character, but without text.
- Speech can be left alone since it's invisible.
- New Line
Line 33
- Speech
- Alright, that's enough for now. I've stopped the buffs and turned us back to normal.
- Start Actions
- RemoveAllBuffs
- Add Another RemoveAllBuffs
- Apply to other character
- CustomCall
- batch target @playerinterest;origins
- Add another CustomCall
- batch targetclear;origins
- Derive to Existing Line: 14
Save and test our buff. In case you and your NPC are already as the max height, open the console and use the lordofshapes command to open a compact editor. From here you can adjust your heights so you can view the buff's effect.
Return to the editor and jump to Line 18
Line 18
- Choice representing this line: Fuse
- Speech
- Let's try fusing?
- New Line
Line 34
- Speech
- Okay, but first there are two ways to break up fusions. Along side the "Fuse" actions, there's also an "Unfuse" action to split us up again. Alternatively, if you open your inventory, you'll see the essence of all of your fusion partners. Right-Click any of them to take them out of the fusion.
- New Line
Line 35
- Speech
- Now then...
- New Line
Line 36
- Character Starring is the Player
- Speech
- Ahhh, there we go!
- Start Actions
Fuse(This is currently buggy as of 0.31.0. Until it gets fixed, use the CustomCall below instead)- CustomCall
- fusenew
- New Line
Line 37
- Character Starring is the Player
- Type is "TextAndChoice"
- Speech
- The fusion is complete. Do you want to unfuse now, or stay like this a little longer?
- Click "New followup line" TWO times
Lines 38
- Character Starring is the Player
- Choice representing this line: Unfuse
- Speech
- I think that's enough for now.
- New Line
Line 40
- Speech
- And there you have it.
- Start Actions
UnFuse(This is currently buggy as of 0.31.0. Until it gets fixed, use the CustomCall below instead)- CustomCall
- unfuse
- Derive to Existing Line: 14
Line 39
- Choice representing this line: Stay like this
- Speech
- I think I'll stay together a little longer.
Save your NPC and test the fusion.
Note: The Fuse and UnFuse actions are special. They must be created as Start Actions only. If you try to set them as an End Action, Bonfire will re-assign them to Start actions when the NPC is saved.
Note II: As of 0.31.0 the Fuse and UnFuse actions aren't working properly. When the actions execute, they will skip over the Speech field, and they will skip over the next line that follows. Also, if the next line is of type TextAndChoice, the game will soft lock, forcing the player to reload the scene. For now, we're substituting those actions with the fusenew and unfuse commands.
Return to the editor and jump to Line 19
Line 19
- Choice representing this line: Teleport
- Speech
- What is teleporting?
- New Line
Line 41
- Speech
- Exactly what it sounds like! When the action activates, either you or I will teleport to the coordinates specified.
- New Line
Line 42
- Speech
- Tell you what: I'm going to teleport somewhere on this island. See if you can find me.
- New Line

Line 43
- Speech
- And here I go!
- Start Actions
- TeleportToCoordinate
- By default the character will teleport to the world's "Origin" point, which is (0,0,0). But we're going to change this so our NPC teleports to the nearby island.
- First, save our NPC but don't speak to them yet. Walk over to the island where you found the Genie's Bracers. Open the console with F1 and enter the refpos command. This will copy your coordinates to the clipboard. Open your NPC in the Editor again and jump to line 43.
- Click "Paste" and you'll see the coordnates we obtained from refpos. For reference, the coordinates I'm using are:
- X = 77, Y = 10, Z = -155
- TeleportToCoordinate
Save, then speak to your NPC to test the Teleport action.
This concludes Section 4's lesson on Custom Actions. Up to this point, we've learned the most important concepts for creating NPCs. We learned how to design our NPC and place them in the world. We gave or NPC a voice and gave them some dialogue. Next we've learned how to branch our conversation with dialogue choices and responses. And lastly we added some interactivity with Custom Actions.
In the next few sections we'll go over some more advanced concepts, and introduce conditional flags to our NPC.
A sample Orc, Demonstrating Section 4's concepts is available here: []
Section 5 - Conditionals
With the previous four concepts, you now have enough knowledge to create fully functioning NPCs on your own. However, we can expand our knowledge and give our NPCs an extra layer of complexity by learning how to create Conditionals. Conditional Boxes are a special type of Dialogue Box that allow us to set one or more rules to check for. If the rules are met, the Conditional Box will execute and the conversation will continue down that branch of dialogue. If the rules aren't met, the Conditional Box is skipped over. Think of this as the If Statement in programming.
There are several uses for Conditionals. You can have an NPC check for the player's dick size and make them deny sex if the player's dick is too big. You can implement a fetch quest where the NPC asks the player to gather a certain number of items. You can even implement special Item Flags that enable the NPC to remember the player, and start new conversations based on their previous encounters. Conditionals are a powerful tool that, when used appropriately, allow you to create NPCs with their own storyline.
Anatomy of a Conditional Box
A Conditional Box is created by setting the "Type" of its Parent to "Conditional"
It is visually similar to the "TextAndChoice" Box, however the "Choice representing this line" field has been replaced by "Execution Conditions." A list of possible conditions is available here.
It's possible to have multiple Conditional Boxes in one layer of dialogue, but only one of them will execute if all of its rules are met.

- Execution Conditions
- This Dialogue will ONLY run is the below condition(s) are met, otherwise it is skipped.
- New Conditions - Changes the rule the box will check for. This is set to an "IfItemFlag" condition by default.
Explanation of Item Flags
ItemFlags are special items created during the conversation. They can hold a single, numerical value, like a variable and are stored within the target's inventory (either the player, the person they're speaking to, or a completely different Orc, if named in the target field).
ItemFlags are controlled using the "SetFlag" Custom Action. This action allows you to set the flag's name and value, and give it to a target. If the target doesn't have this ItemFlag already, a new one is created with the desired a name.
Flags are checked with the "IfItemFlag" Execution Condition. It works similarly to "SetFlag," except you can now use Special Arguments like "greater than" (@>> number) or "less than" (@<< number) to compare the flag's value.
ItemsFlags are useful as you can make your NPCs remember the player and their quest progress. We'll try this out with our NPC by making them skip their introductory text, and instead show their menu right away.
Conditionals Example
First, we're going to re-arrange our dialogue to support ItemFlags. Open our NPC in the Editor, and jump to Line 7.
Line 7
- Click "New followup line" and create Line 44.
Line 44
- We're going to make this the new "entry point" of our NPC's greeting text.
- Speech:
- Hello @playername! Welcome to Part 5 of the Bonfire Dialogue Tutorial!
Back to Line 7
- In the "Set" field, change the value to 44 and click "Set." This will push the entire dialogue tree we've done at this point under line 44.
When creating an NPC's memory, we'll want to do some preliminary checks before we start the actual conversation. First, we'll need to check if the player has the NPC's ItemFlag within their inventory. If not, we need to give it to the player, and start the conversation as normal. If the ItemFlag already exists, then we can start appropriate conversation based on the flag.
To that end, we'll need to convert Line 0 so it gets skipped over, and use its next two children to create and check the ItemFlag.
Line 0
- Set "Type" to "Conditional"
- Speech
- Root of the dialogue tree.
- Start Actions
- Change the "Expression" action to "QuickSkip"
- QuickSkip
- When this line of dialogue is reached, the game will skip it and play the next line in the converstaion instead. Since the Speech field will not play at all, we've re-purposed it to make a note of our conversation's logic.
- Click "New followup line" TWO times.

Line 45
- Speech
- Does the player have the ItemFlag?
- Execution Conditions
- Click "New condition" and by default it will be set to "IfItemFlag."
- IfItemFlag
- Flag ID Name: myNPC_flg
- Flag conent: @any
- ...or instead check on: @playername
- Start Actions
- QuickSkip
- New Line
So in this condition we're checking two things. First, we want to see if the player has an ItemFlag called "myNPC_flg" stored in their inventory somewhere. Next, we want to check if the ItemFlag's content is matching a specific value. At this stage we just want to make sure the player has this ItemFlag at all, so we don't care about the actual value yet. For now the content field is occupied by @any, which means the value can be anything. We will check for specific values later in this example.
Also, just as with Line 0 we added a "QuickSkip" action so no character actually speaks this line. We've re-purposed the Speech field as a comment on the conversation's logic.
Now lets jump to Line 46 (not the newly created Line 47)

Line 46
- Speech
- The player doesn't have the Item Flag. Give them a new one and start the conversation.
- Execution Condition
- Leave this blank. Do not add any extra conditions.
- Start Actions
- SetFlag
- Flag ID Name: myNPC_flg
- Flag content: 0
- ...or instead apply to: @playername
- QuickSkip
- SetFlag
- Derive to Existing Line
- Leave this at 0.
In Line 46 we omitted the Execution Condition. What this means that, if Line 45's condition evaluates to "False" (Does the player have myNPC_flg already?) then this condition will execute instead. There's a benefit to having a blank Execution Condition. If you have multiple condition boxes, each checking a different condition, you would want to have a default path of execution in case everything fails. This will prevent the conversation from ending prematurely, and enables you to run additional task. In programming, think of a blank Condition as the "else" clause in an "If" statement.
Okay, so now we've made sure the player receives the NPC's data flag, but there are a few more things we need to do before we're ready to test. Jump to Line 47
Line 47
- Set Type to "Conditional"
- Speech:
- Padding. The next layer contains every conversation.
- Start Actions
- QuickSkip
- Press "New followup line" TWO times.
Line 48
- Speech:
- First Encounter
- Execution Conditions
- IfItemFlag
- Flag ID name: myNPC_flg
- Flag Content: 0
- ...or instead check on: @playername
- IfItemFlag
- Start Actions
- QuickSkip
- Don't create a new line. We're re-order the boxes again.
Line 49
- Speech:
- Second Encounter
- Execution Conditions
- IfItemFlag
- Flag ID name: myNPC_flg
- Flag Content: 1
- ...or instead check on: @playername
- IfItemFlag
- Start Actions
- QuickSkip
- Again, don't create a new line.
So in Line 48 and 49 we have a check for myNPC_flg's value, similar to Line 45. However, this time we have a specific value to check for. When we created the ItemFlag in Line 46, we gave it an initial value of 0. So when the player speaks to our NPC, the box we called the "First Encounter" will play because it's also looking for an ItemFlag called myNPC_flg with a value of 0. So now let's turn Line 48 into an actual branch of dialogue. Jump to line 44.
Line 44
- In the "Set" field, change the value to 48 and click "Set." All of the dialog at this point will move to Line 48.
Save and speak to your NPC. If everything was done correctly, you shouldn't notice anything different. Your NPC will speak to you and present the choice menu as normal. However there will be a subtle change. Open the console with the F1 key and enter the showhiddenitems command. This will show you all the hidden fields and values Bonfire uses to manage its characters. Scroll to the bottom of your inventory, and you should see a blue icon with a giant "S." If you hover over this you'll see:

ITEM FLAG
NAME: MYNPC_FLG
DATA: 0
Our NPC gave us the ItemFlag we created earlier! Now that we know how this works, we can tweak our conversation a little more. Go back into the NPC Editior, and jump to Line 14.
Line 14
- Change Speech to:
- Welcome back @playername, What do you want to do?
- In the "Set" field, change the value to 49 and click "Set." All the choices we created will move under line 49.
Line 8
- Change Speech to:
- Now we'll learn about Conditionals. If you followed the tutorial up to this point, you'll notice that you now have an ItemFlag called "myNPC_flg" within your inventory.
Line 9
- Change Speech to:
- Right now it's set to 0. I'm going to set it to 1, and this will make me skip this introduction every time we speak. I'll end the converssation here, but talk to me agin when you're ready.
- End Action
- SetFlag
- Flag ID name: myNPC_flg
- Flag content: 1
- ...or instead apply to: @playername
- SetFlag
Save your NPC and speak to them again. After the first conversation ends, speak to them again and instead of the introduction, you'll be presented with the dialogue options right away. Every time you speak with your NPC, you'll always be presented with this dialogue option.
Next, open the console with F1 and enter the save command to save your progress at this point. Close Bonfire, re-open it, and com back to speak to your NPC. Instead of the usual greeting, they'll jump right to the dialogue options.
With this, you've created an NPC that remembers you! By setting up ItemFlags, you're giving NPCs a point of reference to start up different conversations. This enables you to create multi-part quest lines with different objects.
It is possible to clear the NPC's memory and start over, however. If you use the dory command, or speak to Kult, they will clear our all ItemFlags and other NPC information from your inventory. This isn't recommended on your main Orc, because it essentially resets your quest progress for the whole game. Use it wisely.
A sample Orc, Demonstrating Section 5's concepts is available here: []
Section 6 - Fetch Quest Example
Now that we have the basics of Conditionals down and created our NPC's memory, let's make a simple fetch quest that asks the player to collect coconuts around the island. We'll first create a new dialogue choice to support this. Go back to the NPC editor and load your NPC.
