RPG Builder Support

This page describes how to set up the Dialogue System with BLINK's RPG Builder. (RPG Builder is required.)

RPG Builder copyright © BLINK.

RPG Builder Support Setup

Integration Video Tutorial

The RPG Builder integration requires RPG Builder 2.0.7.1+ and Dialogue System 2.2.33+ or the integration package on the Dialogue System Extras page.

Check the Dialogue System Extras page for updated integration packages.

Import two unitypackages:

  • Plugins ► Pixel Crushers ► Common ► Third Party Support ► RPG Builder Support and
  • Plugins ► Pixel Crushers ► Dialogue System ► Third Party Support ► RPG Builder Support
  • Or updated versions of the integration packages from the Dialogue System Extras page if available.

This will unpack files into:

  • Assets ► Pixel Crushers ► Common ► Third Party Support ► RPG Builder Support and
  • Assets ► Pixel Crushers ► Dialogue System ► Third Party Support ► RPG Builder Support.

The RPG Builder integration provides these features:

  • Standard RPG Builder interactable NPCs can play Dialogue System conversations or barks, including conversations that control quests.
  • InteractableObjects can play conversations or barks.
  • Conversations, barks, and quests can access RPG Builder features such as the player's inventory.
  • The Dialogue System ties into RPG Builder's saved games to save its own data.

Editor Setup

Follow these steps to add the Dialogue System integration to the RPG Builder editor window:

  • Create a new, empty folder: Assets ► Blink ► Tools ► RPGBuilder ► Resources ► Database ► DialogueSystemNpcTemplates.
  • Inspect Assets ► Blink ► Tools ► RPGBuilder ► Resources ► EditorData ► EditorCategories ► AI.
  • Add Assets ► Pixel Crushers ► Third Party Support ► RPG Builder Support ► Resources ► EditorData ► EditorEntryModules ► RPGBuilderEditorDialogueSystemModule to the Modules list:
  • Close & reopen the RPG Builder editor window. The AI section will now have a Dialogue System subsection:

Main Menu Scene Setup

Follow these steps to edit the Main Menu scene for Dialogue System integration:

  • Open the Main Menu scene.
  • Add the prefab Assets ► Pixel Crushers ► Dialogue System ► Third Party Support ► RPG Builder Support ► Prefabs ► DialogueManager_RPGBuilder to the scene.
  • Create a dialogue database and assign it to your Dialogue Manager's Initial Database field. Note: You may want to do this after experimenting with the integration's demo prefabs, which rely on the demo database.
  • Optional: A very basic dialogue UI named Basic Standard Dialogue UI Variant is in the UI Prefabs subfolder. You can duplicate this prefab, customize its appearance, and assign it to the DialogueManager_RPGBuilder's Display Settings > Dialogue UI field.
  • Optional: A very basic quest log window named Basic Standard UI Quest Log Window Variant is in the UI Prefabs subfolder. You can duplicate this prefab, customize its appearance, and assign it to the DialogueManager_RPGBuilder's Instantiate Prefabs component > Prefabs list in place of the original. If you use a different prefab instead of this one, add a StandardUIQuestLogWindowDisplayPanel component to it, add a Canvas Group to the main panel, and assign the Canvas Group to the component.

    • In the RPG Builder window, navigate to Settings > General > Action Key List.
    • Add a new Action Key whose Action Name is "UI_PANEL_QUEST_LOG_WINDOW".
    • Set Display Name to "Quest Log Window" (or whatever you prefer) and Category to "UI".
    • This will let the player set a key binding in RPG Builder's Settings menu.
    • If you want to add a button to the toolbar to show or toggle the quest log window, add a UI Button to RPG Builder's HUD prefab > Toolbar_Buttons. Add a DialogueSystemQuestLogControl component to the UI Button, and configure the OnClick() event to call DialogueSystemQuestLogControl.OpenQuestLogWindow or DialogueSystemQuestLogControl.ToggleQuestLogWindow.
  • Edit RPG Builder's RPGBuilderEssentials script. In the ResetCharacterData() method at the bottom of the script, add this line:
    public void ResetCharacterData(bool deleteEssentials)
    {
    ...
    gameObject.AddComponent<Character>();
    }
    PixelCrushers.SaveSystem.ResetGameState(); // <-- ADD THIS LINE
    }
    This is the main Save System class.
    Definition SaveSystem.cs:17
    static void ResetGameState()
    Clears the SaveSystem's saved game data cache.
    Definition SaveSystem.cs:1090
    Definition MessageEventsEditor.cs:7

Notes about Dialogue Manager: The DialogueManager_RPGBuilder prefab is a variant of the Dialogue System's default Dialogue Manager prefab. It has the following changes:

  • Assigned the UI variants described in the steps above. These variants primarily just untick the Add Event System If Needed checkbox since RPG Builder will instantiate an EventSystem.
  • Set Other Settings > Conversation Controller Warmup to Off.
  • Unticked Input Device Manager component > Control Cursor State.
  • Added Save System components.
  • Added Dialogue System RPG Builder Bridge component.

You may want to make a new prefab variant of the DialogueManager_RPGBuilder prefab, and add your prefab variant to the Main Menu scene instead of the original. This way you can customize it without worrying about overwriting your customizations if you import an updated integration package. If you plan to use RPG Builder's Character Loader feature, also add the prefab variant to your gameplay scenes.

RPGB UIs need a Display Panel component. This includes dialogue UIs with the DS integration. The Basic Standard Dialogue UI Variant prefab included with the integration is already set up with a Display Panel. If you want to use a different UI as a starting point instead of customizing Basic Standard Dialogue UI Variant:

  1. Add a StandardDialogueUIDisplayPanel component to the dialogue UI.
  2. Tick Pause Game.
  3. Assign the Dialogue Panel child GameObject to This CG. (Add a Canvas Group if Dialogue Panel doesn't already have one.)
  4. UNtick the StandardDialogueUI component's Add Event System If Needed checkbox.

Similarly, if you don't want to use the Basic Standard UI Quest Log Window Variant prefab, add a Display Panel to your quest log window, and untick Add Event System If Needed.

After setting up the editor and Main Menu scene, if you want to quickly see basic Dialogue System functionality in action in RPG Builder's default Demo scene, see the Demo Objects section. Then return to Gameplay Scene Setup below to set up your own scenes.

Note: John Stairs RPG Camera & Controller

If you're using John Stairs' MMO controller, you'll also need to add a Dialogue System Events component to your player prefab. Configure the OnConversationStart() event to disable the RPGControllerMMO component. Configure OnConversationEnd() to re-enable it. If you're using the ARPG controller, you don't need to use Dialogue System Events.

Gameplay Scene Setup

In your gameplay scenes, you can set up InteractableObjects, NPCs, etc., to play barks or conversations, and to check and update quest states. In your conversation and Dialogue System Triggers, you can use RPG Builder Lua Functions to interact with RPG Builder.

InteractableObject Setup

Use InteractableObjects for objects such as signs or NPCs that the player can talk to directly. (For NPCs that will use RPG Builder's NPC Interaction Panel, see NPC Setup.)

  • Configure the object with a Dialogue System Trigger set to OnUse, and other Dialogue System components as needed.
  • Add an Interactable Object component.
    • If you want to run the Dialogue System Trigger when the player enters its trigger collider, tick Trigger Enabled?
    • If you want to run the Dialogue System Trigger when the player clicks it with a mouse, tick Click Enabled?
    • Configure Actions > UnityEvent to call the Dialogue System Trigger's OnUse method.
    • Set State > Interaction Time to zero.
  • For objects that don't require player responses, such as signposts:
    • Add an Override Dialogue UI component to the signpost, and assign the Basic Standard Dialogue UI prefab to it.
    • In the Dialogue Editor, open the conversation. Then select Menu > Conversation Properties. In Inspector view, set the Actor and Conversant dropdowns both to the sign actor (or any actor other than the Player). Then inspect the dialogue entry node(s) and make sure both dropdowns are not set to the Player.

To see an example, add the Signpost_Bubble_Trigger_CautionBears prefab to your gameplay scene. It's configured like this:

When the player enters its trigger collider, it will show a one-line conversation in an overhead text bubble:

If you want to run RPG Builder Game Actions in conversations, you can do the following:

  • Create an empty GameObject with a unique name.
  • Add an Interactable Object component.
  • Untick Activation > Click Enabled and Trigger Enabled.
  • Use the rpgUseInteractableObject(gameObjectName) Lua function in your conversation. (See RPG Builder Lua Functions)

Other Object Interaction

To add a "Play Conversation" Game Action to RPG Builder – for example to configure items to play conversations when they're used – see RPG Builder Code Customization.

NPC Setup

To configure an NPC to play a Dialogue System conversation or bark instead of RPG Builder dialogue:

  • In the RPG Builder editor window, tick the NPC's AI > NPCs > FUNCTIONS > Dialogue? checkbox.
  • In AI > Dialogue System, add an entry for the NPC. Tick Has Interaction Conversation or Has Interaction Bark, and select a conversation:
  • You can also tick Has Idle Bark to make the NPC bark on a regular frequency without requiring player interaction.

Interactive Conversation
If you select Has Interaction Conversation, the NPC will play a Dialogue System conversation when the player selects the NPC Interaction Panel's dialogue option. By default, it will use the dialogue UI assigned to the Dialogue Manager's Display Settings. You can override this by adding an Override Dialogue UI component to the NPC prefab.

Interactive Bark
If you select Has Interaction Bark, the NPC will play a bark when the player selects the NPC Interaction Panel's dialogue option. Make sure to add a bark UI to the NPC prefab so it's spawned with a bark UI. You can add a Dialogue Actor component and assign a bark UI to it, or add a bark UI child directly to the prefab.

Idle Bark
If you select Has Idle Bark, the NPC will bark lines from a conversation at a specified frequency. This occurs independently from interactive barks or conversations. You must add a Dialogue System For Entity component to the NPC prefab. Make sure to also add a bark UI to the NPC prefab so it's spawned with a bark UI. You can add a Dialogue Actor component and assign a bark UI to it, or add a bark UI child directly to the prefab.

Quest Setup

The integration provides these helper components to facilitate setting up Dialogue System quests:

Combat Entity Event: Add to a CombatEntity to expose an OnDeath() UnityEvent. You can connect this UnityEvent to a Dialogue System Trigger to do things such as updating a quest state or incrementing a variable.

Dialogue System Item Events: Exposes UnityEvents when the player gains or loses a specific type of item. You can also specify a list of items that will trigger a quest UI update when the player gains or loses an item in the list.

Demo Objects

If you want to quickly see some basic Dialogue System functionality after completing RPG Builder Support Setup and Main Menu Scene Setup, follow these steps:

  1. Use RPG Builder's default Demo scene.
  2. In the RPG Builder editor, inspect the HumanNPC AI. Tick the Dialogue? checkbox.
  3. Create this folder if you haven't already: Assets ► Blink ► Tools ► RPGBuilder ► Resources ► Database ► DialogueSystemNpcTemplates.
  4. Copy the HumanNPC_DIALOGUESYSTEM asset from Assets ► Pixel Crushers ► Dialogue System ► Third Party Support ► RPG Builder Support ► Demo to Assets ► Blink ► Tools ► RPGBuilder ► Resources ► Database ► DialogueSystemNpcTemplates. This will make the starting HumanNPC at the top of the hill play a simple Dialogue System conversation. This conversation demonstrates how to show the player's name in dialogue and offers some quests.
  5. Add the prefab Demo Prefabs ► DialogueSystemDemoObjects to the Demo scene. This will add a signpost that plays a simple bubble subtitle over a signpost when the player enters the signpost's trigger collider.
  6. Play the MainMenu scene.

Demo Quests

The NPC offers these quests:

  • Lost Hat: The player must fetch a hat from the valley. Demonstrates RPG Builder Lua Functions rpgGetItemAmount() and rpgRemoveItem().
  • Kill Skeleton: The player must kill a skeleton near the training dummies. Demonstrates CombatEntityEvent component.
  • Boar Fur: The player must loot fur from a boar. Demonstrates DialogueSystemItemEvents component.

RPG Builder Lua Functions

You can type the following Lua functions directly into Conditions and Script fields, or use the "..." dropdown wizards to access them from the Custom → RPG Builder dropdown submenu.

In Lua functions, all names refer to entry names, not display names, unless otherwise specified.

Lua Function Description
PLAYER -
rpgGetPlayerName() Returns the player's display name.
rpgGetPlayerRace() Returns the display name of the player's race.
rpgGetPlayerGender() Returns the name of the player's gender.
rpgGetPlayerClass() Returns the display name of the player's class.
rpgGetPlayerLevel() Returns the player's level.
rpgAddCharacterExperience(amount) Adds character experience.
STATS -
rpgGetStat(statName) Returns the current value of a stat.
FACTION -
rpgGetEntityStanceToFaction(entityName, otherFactionName) Given an entity's name (or blank for player) and other faction, returns the name of the entity's stance toward the other faction.
rpgChangeFaction(entityName, factionName) Changes an entity's faction.
rpgAddFactionPoints(factionName, amount) Adds points to a faction's stance to the player.
rpgRemoveFactionPoints(factionName, amount) Removes points to a faction's stance to the player.
rpgResetFactionPoints(factionName) Resets a faction's points.
INVENTORY -
rpgGetEmptySlotsCount() Returns the number of empty slots in the player's inventory.
rpgGetItemAmount(itemName) Returns the amount of an item that the player has.
rpgAddItem(itemName, amount, automaticallyEquip:bool) Adds an amount of an item to the player's inventory.
rpgRemoveItem(itemName, amount) Removes an amount of an item from the player's inventory.
rpgAddCurrency(currencyName, amount) Adds an amount of a type of currency to the player.
rpgRemoveCurrency(currencyName, amount) Removes an amount of a type of currency from the player.
ABILITIES -
rpgIsAbilityKnown(abilityName) Returns true if an ability is known, otherwise false.
rpgGetAbilityRank(abilityName) Returns the current rank of an ability.
rpgAddAbility(abilityName) Adds an ability.
rpgRankUpAbility(abilityName, talentTreeName) Ranks up an ability in a talent tree.
TALENT TREES -
rpgGetTreePoints(talentTree) Returns the current number of points available in a talent tree.
rpgAddTreePoints(talentTree, amount) Adds points to a talent tree.
SKILLS -
rpgIsSkillKnown(skillName) Returns true if a skill is known, otherwise false.
rpgGetSkillLevel(skillName) Returns the current level of a skill.
rpgAddSkill(skillName) Adds a skill.
rpgGainLevel(skillName, amount) Gives the player levels in a skill.
rpgAddSkillExperience(skillName, amount) Gives the player experience points in a skill.
RECIPES -
rpgGetRecipeRank(recipeName) Returns the player's current rank with a recipe (or zero if not learned yet).
rpgCanRankUpRecipe(recipeName, treeName) Returns true if player can rank up recipe (has points, ranks available, & meets requirements).
rpgRankUpRecipe(recipeName, treeName) Ranks up a recipe in a talent tree. If the player doesn't know the recipe yet, this teaches the recipe.
ENTITIES -
rpgEnterCombat(entityName) Makes an entity enter combat mode.
rpgPlayCombatEffect(entityName, effectName, rank) Starts an RPG Effect on an entity, where effectName is the effect's entry name and rank is a number.
RPG BUILDER QUESTS -
rpgProposeQuest(questName) Opens RPG Builder's quest proposal window.
rpgAcceptQuest(questName) Accepts an RPG Builder quest.
rpgTurnInQuest(questName) Turns in an RPG Builder quest.
rpgAbandonQuest(questName) Abandons an RPG Builder quest.
rpgIsQuestOnGoing(questName) Returns true if a quest is ongoing. (Note capitalization of function name.)
rpgIsQuestCompleted(questName) Returns true if a quest is in the completed state.
rpgIsQuestTurnedIn(questName) Returns true if a quest is in the turned-in state.
rpgIsQuestAbandoned(questName) Returns true if a quest is in the abandoned state.
INTERACTABLE OBJECTS -
rpgSetInteractableObjectState(objectName, state) On a GameObject named objectName, set Interactable Object's state to Ready, OnCooldown, or Unavailable.
rpgUseInteractableObject(objectName) Uses an Interactable Object on the named GameObject.
INTERACTABLE OBJECTS -
rpgOpenPanel(panelName) Opens an RPG Builder panel (see below).
rpgClosePanel(panelName) Closes an RPG Builder panel (see below).
rpgOpenCharacterTab(tabName) Opens Character panel to a specified tab (see below). Use rpgClosePanel("Character") to close.
rpgOpenTalentTreePanel(talentTree) Opens the Talent_Tree panel, showing a specified talent tree.

Notes:

  • CHANGED: rpgGainExperience() was renamed to rpgAddSkillExperience().
  • Inventory: rpgGetItemAmount() and rpgRemoveItem() do not count items that are equipped on the player, only items in the player's inventory slots.
Panel Name Description
Character Character window (Equipment, Stats, Talents, Factions)
Weapon_Templates Weapon Templates
Inventory Inventory
Spellbook Spell book
Skill_Book Skills book
Enchanting Enchanting
Socketing Socketing
Quest_Log Quest log (RPG Builder quests, not Dialogue System quest log window)
Stats_Allocation Stats allocation
Options Options
— DEVELOPER UI — Developer UI
Character Tab Name Description
GEAR Character inventory tab
STATS Character stats tab
TALENTS Character talents tab
FACTIONS Character factions tab

RPG Builder Sequencer Commands

These sequencer commands are available:

rpgCraft(stationName)

Opens the Crafting UI, where stationName is a GameObject name or name of a crafting station as defined in the RPG Builder window. It will look for a GameObject first. If it doesn't find it by name, it will use the first crafting station GameObject that is assigned to the named crafting station type.

rpgMerchant()

Opens the Merchant window of the NPC that the player is currently interacting with.

rpgTeleport(spawnpoint, [scene], [subject])

Parameters:

  • spawnpoint: Name of GameObject whose position to teleport to. Usually an empty GameObject.
  • scene: (Optional) Scene to teleport into. If omitted, stay in same scene.
  • subject: (Optional) GameObject to teleport. If omitted, teleport player.

RPG Builder Code Customization

To add a "Play Conversation" Game Action:

  1. In GameActionsData.cs line 151 (as of RPG Builder 2.0.7), add Conversation = 4, to the NPCAction enum list.
  2. In GameActionsManager.cs line 238, add:
case GameActionsData.NPCAction.Conversation:
foreach (var combatEntity in GameState.combatEntities)
{
if (combatEntity.IsPlayer()) continue;
if (combatEntity.GetNPCData().ID == gameAction.NPCID)
{
PixelCrushers.DialogueSystem.RPGBuilderSupport.DialogueSystemRPGBuilderBridge.Instance.OnShowInteractionsPanel(combatEntity);
break;
}
}
break;
Definition DemoInputRegistration.cs:4
  1. Add an NPC for the item. Tick Actions > Dialogue?. In Dialogue System section, tick Has Interaction Conversation, select conversation, tick Bypass Interactions Panel. Create an invisible NPC instance/spawner in the scene, hidden somewhere not visible to player.
  2. In the item's On Use Actions, add a game action: Type = NPC, Action = Conversation, NPC = the NPC for the item.

<< Third Party Integration