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.
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:
This section contains more detailed steps to make the Dialogue System available to Bolt.
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:
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. |
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.
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:
BoltEvent("InventoryManager", "AddGold", 50)
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.