Bolt Support

This page explains how to use Ludiq's Bolt Visual Scripting with the Dialogue System.

For the version of Visual Scripting that has been integrated into Unity as the Visual Scripting package, see Visual Scripting Support.

Bolt copyright © Ludiq, Unity Technologies.

How to Set Up Bolt Support

These instructions are for Ludiq's Bolt Visual Scripting. For the version of Visual Scripting that has been integrated into Unity as the Visual Scripting package, see Visual Scripting Support.

Import the package Third Party Support ► Bolt Support. This will unpack files into the folder Assets ► Pixel Crushers ► Dialogue System ► Third Party Support ► Bolt Support.

Bolt works differently from other visual scripting systems. In other visual scripting systems, third party integrations typically provide a set of scripts that extend the system's library of actions (e.g., Start Conversation action, Set Quest State action, etc.). Bolt works directly with the third party asset. In the steps below, you will use Bolt's Unit Options Wizard to allow Bolt to access Dialogue System methods such as StartConversation and SetQuestState.

To set up Bolt support:

  1. Select menu item Tools → Bolt → Unit Options Wizard....
    • In the Assemblies section, add Assembly-CSharp-firstpass to the list if it's not present. If you're using the evaluation version of the Dialogue System, or if you've imported the Dialogue System's assembly definition files, select the PixelCrushers and DialogueSystem assemblies instead.
    • In the Types section, select types such as DialogueManager or DialogueLua to give Bolt access to those parts of the Dialogue System.
    • For detailed steps and a list of common Types, see Bolt Unit Options.
  2. If you want Bolt to react to Dialogue System event messages such as OnConversationStart, import the package Third Party Support ► Bolt Support. This will add a component Dialogue System Bolt Custom Events that handles Dialogue System events as Bolt Custom Events. For details, see Dialogue System Bolt Custom Events.
  3. If you want to invoke Bolt Custom Events from inside conversations, add a Dialogue System Bolt Lua component to the Dialogue Manager. Do not add Dialogue System Bolt Lua to other GameObjects; just the Dialogue Manager. For details, see Bolt Lua Functions.

Bolt Unit Options

This section contains more detailed steps to make the Dialogue System available to Bolt.

  1. Select menu item Tools → Bolt → Unit Options Wizard.... This will open Bolt's Unit Options Wizard.
  2. In the Assemblies stage, add Assembly-CSharp-firstpass and click Next:
  1. In the Type Options stage, add Dialogue System types (see below for list) and click Generate:

Bolt Unit Options

These are common types to add to Bolt:

Type Reference Gives Access To
DialogueManager PixelCrushers.DialogueSystem.DialogueManager Control conversations & barks
Show alerts
Play sequences
Add/remove databases
and more...
DialogueLua PixelCrushers.DialogueSystem.DialogueLua Get/set variables & fields
(Get methods return Lua.Result).
Lua.Result PixelCrushers.DialogueSystem.Lua.Result Result from Lua; can get value asString, asBool, etc.
QuestLog PixelCrushers.DialogueSystem.QuestLog Control quests.
SaveSystem PixelCrushers.SaveSystem Save & load games, change scenes.

Once added, you can use them in Bolt. The example screenshot below uses DialogueLua.SetVariable:

Dialogue System Bolt Custom Events

Add a Dialogue System Bolt Custom Events component to GameObject(s) that receive Dialogue System events (see Script Messages & Events) and for which you want to direct those events to Bolt Custom Events. The component can redirect these events:

Event Argument When It Occurs
Conversation Events Conversation-related events.
OnConversationStart Transform When a conversation starts.
OnConversationEnd Transform When a conversation ends.
OnConversationCancelled Transform When a conversation is cancelled.
OnConversationLine Subtitle Just before a conversation shows a line of dialogue.
OnConversationLineEnd Subtitle When a conversation line ends.
OnConversationLineCancelled Subtitle When a conversation line is cancelled.
OnConversationResponseMenu Response[] Just before a conversation response menu appears.
OnConversationTimeout (none) When a conversation times out.
OnLinkedConversationStart Transform When a conversation crosses a cross-conversation link.
Bark Events Bark start, end, and line events.
OnBarkStart Transform When a bark starts.
OnBarkEnd Transform When a bark ends.
OnBarkLine Subtitle Invoked just before showing a bark.
Sequence Events Sequence start and end events.
OnSequenceStart Transform When a sequence starts (except conversation sequences).
OnSequenceEnd Transform When a sequence ends.
Quest Events Quest state change events.
OnQuestStateChange string When a quest or quest entry state has changed. (Argument is quest name.)
OnQuestTrackingEnabled string When the player has toggled tracking on for a quest.
OnQuestTrackingDisabled string When the player has toggled tracking off for a quest.
UpdateTracker (none) When the Dialogue System needs to update the quest tracker HUD.
Pause Events Events related to pausing and unpausing Dialogue Time.
OnDialogueSystemPause (none) When Dialogue Time is paused.
OnDialogueSystemUnpause (none) When Dialogue Time is unpaused.

Bolt Lua Functions

If you want to invoke a Bolt Custom Event from a dialogue entry node's Script field, add a Dialogue System Bolt Lua component to the Dialogue Manager. This will add the following Lua functions:

Lua Function Description
BoltEvent(objectName:string, eventName:string) Invokes a custom event on a GameObject.
BoltEventString(objectName:string, eventName:string, arg:string) Invokes a custom event on a GameObject with a string argument.
BoltEventBool(objectName:string, eventName:string, arg:bool) Invokes a custom event on a GameObject with a Boolean (true/false) argument.
BoltEventFloat(objectName:string, eventName:string, arg:float) Invokes a custom event on a GameObject with a floating point number argument.

These Lua functions invoke a Bolt Custom Event on a GameObject named objectName.

  • If objectName is blank, it will send the event to the GameObject that has the Dialogue System Bolt Lua component (i.e., the Dialogue Manager).
  • If objectName is "speaker", it will send the event to the current dialogue entry node's speaker, or the Dialogue Manager if no conversation is active.
  • If objectName is "listener", it will send the event to the current dialogue entry node's listener, or the Dialogue Manager if no conversation is active.
  • Otherwise it will send it to the named GameObject.

Bolt Lua Example

Let's say you have a GameObject named "InventoryManager" with a Bolt graph. This graph handles a custom event "AddGold" with a float argument. To invoke this event in a dialogue entry:

  • Dialogue Text: "Here's your 50gp reward."
  • Script: BoltEvent("InventoryManager", "AddGold", 50)

Bolt Sequencer Commands

To send an arbitrary custom event to a Bolt machine, use the BoltEvent() sequencer command:

Lua Function Description
BoltEvent(eventName, [subject]) Invokes a custom event on a subject. Default subject: speaker.

Note that the order of parameters is different for the BoltEvent() sequencer command than for the Lua function. This is so you can omit the subject if you want to send the event to the speaker.


<< Third Party Integration