Let Typewriter Effect communicate with Bolt

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
F1foux
Posts: 26
Joined: Mon Jul 19, 2021 1:21 pm

Let Typewriter Effect communicate with Bolt

Post by F1foux »

Hi Tony,

I have a question regarding the typewriter effect. I'm using a Bolt State Machine to control the dialogue animations of my NPCs and I saw that the Typewriter Effect sends a message once it's done typing. Is there an easy way to make the Typewriter effect send out a Bolt Custom Event once it's done typing?

I've tried it with adding a sequencer command to all the dialogue entries: BoltEvent(Typed, Speaker)@Message(Typed);

But that doesn't seem to work.

Thank you very much for hinting me the right direction

Cheers
User avatar
Tony Li
Posts: 21977
Joined: Thu Jul 18, 2013 1:27 pm

Re: Let Typewriter Effect communicate with Bolt

Post by Tony Li »

Hi,

That should work. Perhaps the conversation isn't using the GameObject that you expect for the speaker.

If you temporarily set the Dialogue Manager's Other Settings > Debug Level to Info, it will log this info to the Console window when the conversation starts:

Dialogue System: Starting conversation 'title' with actor=XXX and conversant=YYY

where XXX and YYY are the GameObjects being used as the primary actor and conversant. One of them will most likely be the dialogue entry node's speaker.

When the BoltEvent() sequencer command runs, it will log two lines to the Console. The second line will look like this:

Dialogue System: Sequencer: BoltEvent(Typed, ZZZ)

where ZZZ is the name of the GameObject that it's sending the Bolt event to. Make sure ZZZ is the correct GameObject.

If not, see: Character GameObject Assignments.
F1foux
Posts: 26
Joined: Mon Jul 19, 2021 1:21 pm

Re: Let Typewriter Effect communicate with Bolt

Post by F1foux »

Yes, got it working. Thank you.
Unfortunately I ran into another problem. I have the dialogue manager send Bolt Events to another gameobject during a conversation, the event: BoltEventFloat("MyGameObject", "Start_Game", 0) works fine 3 times but when I want to call it a forth time I get this error:

Dialogue System: Lua code 'BoltEventFloat("MyGameObject", "Start_Game", 0);' threw exception 'Tried to invoke a function call on a non-function value. If you're calling a function, is it registered with Lua?'
UnityEngine.Debug:LogError (object)

Why would it work 3 times but then it doesn't understand it?
Sorry for my stupid questions Tony, I'm coming from an art background. I really apreciate all the help you give us.

Cheers
User avatar
Tony Li
Posts: 21977
Joined: Thu Jul 18, 2013 1:27 pm

Re: Let Typewriter Effect communicate with Bolt

Post by Tony Li »

Hi,

Have you disabled domain reloading? This updated Bolt integration supports disabled domain reloading:

DS_BoltSupport_2022-05-03.unitypackage

If that doesn't fix it, please double check that the spelling and capitalization of BoltEventFloat is correct.

Note: The updated integration also adds a submenu to the Script field's "..." dropdowns. If you select Custom > Bolt, you can add templates for the BoltEvent***() functions and then just fill in the parameters:

boltSubmenu.png
boltSubmenu.png (9.67 KiB) Viewed 796 times
F1foux
Posts: 26
Joined: Mon Jul 19, 2021 1:21 pm

Re: Let Typewriter Effect communicate with Bolt

Post by F1foux »

Hi,

I imported the Unity package, I didn't have to do anything additionally with it, right?
I went into my dialogue entries and rewrote all the BoltEvents with the new preset way you showed me and I enabled domain reloading but I still get the error.

I even copied and pasted the scripts from the other dialogue entries that work... but it doesn't work... is it possible that dialogue entries can corrupt or something?
User avatar
Tony Li
Posts: 21977
Joined: Thu Jul 18, 2013 1:27 pm

Re: Let Typewriter Effect communicate with Bolt

Post by Tony Li »

It's probably not a corrupt dialogue entry. It sounds like something is unregistering the Bolt integration's custom Lua functions.

Is the Dialogue System Bolt Lua component on the Dialogue Manager GameObject?

Is there any specific activity that happens prior to the error, such as changing scenes?

To determine if the Lua functions are unregistered, temporarily set the Dialogue Manager's Other Settings > Debug Level to Info. When the game starts (more accurately, when the Dialogue Manager starts), you should see Console logs like:

Dialogue System: Registering Lua function BoltEventFloat

You should *not* see messages like this:

Dialogue System: Unregistering Lua function BoltEventFloat

If you do, please click on the message, press Ctrl+C to copy its details to the clipboard, and paste the clipboard here.
F1foux
Posts: 26
Joined: Mon Jul 19, 2021 1:21 pm

Re: Let Typewriter Effect communicate with Bolt

Post by F1foux »

Hi Tony,

As you said... there's some unregistering happening:

Dialogue System: Unregistering Lua function BoltEvent
UnityEngine.Debug:Log (object)
PixelCrushers.DialogueSystem.Lua:UnregisterFunction (string) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Lua/Lua Wrapper/Lua Interpreter/Lua.cs:297)
PixelCrushers.DialogueSystem.BoltSupport.DialogueSystemBoltLua:OnDisable () (at Assets/Pixel Crushers/Dialogue System/Third Party Support/Bolt Support/DialogueSystemBoltLua.cs:52)
PixelCrushers.UIPanel:Start () (at Assets/Plugins/Pixel Crushers/Common/Scripts/UI/UIPanel.cs:115)

Dialogue System: Unregistering Lua function BoltEventString
UnityEngine.Debug:Log (object)
PixelCrushers.DialogueSystem.Lua:UnregisterFunction (string) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Lua/Lua Wrapper/Lua Interpreter/Lua.cs:297)
PixelCrushers.DialogueSystem.BoltSupport.DialogueSystemBoltLua:OnDisable () (at Assets/Pixel Crushers/Dialogue System/Third Party Support/Bolt Support/DialogueSystemBoltLua.cs:53)
PixelCrushers.UIPanel:Start () (at Assets/Plugins/Pixel Crushers/Common/Scripts/UI/UIPanel.cs:115)

Dialogue System: Unregistering Lua function BoltEventBool
UnityEngine.Debug:Log (object)
PixelCrushers.DialogueSystem.Lua:UnregisterFunction (string) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Lua/Lua Wrapper/Lua Interpreter/Lua.cs:297)
PixelCrushers.DialogueSystem.BoltSupport.DialogueSystemBoltLua:OnDisable () (at Assets/Pixel Crushers/Dialogue System/Third Party Support/Bolt Support/DialogueSystemBoltLua.cs:54)
PixelCrushers.UIPanel:Start () (at Assets/Plugins/Pixel Crushers/Common/Scripts/UI/UIPanel.cs:115)

Dialogue System: Unregistering Lua function BoltEventFloat
UnityEngine.Debug:Log (object)
PixelCrushers.DialogueSystem.Lua:UnregisterFunction (string) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Lua/Lua Wrapper/Lua Interpreter/Lua.cs:297)
PixelCrushers.DialogueSystem.BoltSupport.DialogueSystemBoltLua:OnDisable () (at Assets/Pixel Crushers/Dialogue System/Third Party Support/Bolt Support/DialogueSystemBoltLua.cs:55)
PixelCrushers.UIPanel:Start () (at Assets/Plugins/Pixel Crushers/Common/Scripts/UI/UIPanel.cs:115)

All the Bolt functions seem to get unregistered... I don't know why this would happen. I didn't even know that that's something you can do.

How can I stop it?

Thanks you
F1foux
Posts: 26
Joined: Mon Jul 19, 2021 1:21 pm

Re: Let Typewriter Effect communicate with Bolt

Post by F1foux »

Ok, I got it working again. I replaced the Dialogue Manager with an older Prefab of my Dialogue Manager and now it seems to work again. The unregistering notifications are gone too. But I wish I knew what I changed in the Manager to make it do that so I could avoid doing it again...

Thank you as always Tony.
User avatar
Tony Li
Posts: 21977
Joined: Thu Jul 18, 2013 1:27 pm

Re: Let Typewriter Effect communicate with Bolt

Post by Tony Li »

Hi,

It looks like your DialogueSystemBoltLua component is on a GameObject with a UIPanel component, probably something in the dialogue UI.

Make sure your Dialogue Manager GameObject is a root GameObject (not a child of another GameObject) and that it doesn't have a UIPanel component. Remove all other instances of the DialogueSystemBoltLua component, and put one only on the Dialogue Manager.
Post Reply