OnConversationEnd from DialogueManager.instance?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
nicmar
Posts: 133
Joined: Wed Aug 21, 2019 2:39 am

OnConversationEnd from DialogueManager.instance?

Post by nicmar »

I have a TextManager script, that subscribes like this:

Code: Select all

DialogueManager.instance.conversationEnded += OnConversationEnd;
Then it runs this method, and if the player is involved with the conversation, there's a cutscene happening, and I want to disable the cutscene mode (cinematic bars and zoom).

However, I always get the other actor that the player is talking to, even if I have the player as Actor in the START-node.
What decides which actor is sent with this call?

Can I fix this, without having to put an OnConversationEnd on the actor itself?

Code: Select all

private void OnConversationEnd(Transform actor) {
	Debug.Log("OnConversationEnd with " + actor + "", actor.gameObject);

	if (actor == playerTransform) {
		MasterManager.GameManager.cutSceneController.HideBars();
		MasterManager.GameManager.cutSceneController.SetCameraZoomNormal();
	}
}
Working on SpaceChef - A wacky open world space western, featuring a chef with nothing to loose, after he loses everything.. ;) Follow our work on @BlueGooGames.
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: OnConversationEnd from DialogueManager.instance?

Post by Tony Li »

Hi,

The conversationEnded event should point to the Conversation Actor (the player), although if they were switched on the Dialogue System Trigger it could be pointing to the conversant.

Instead, uou can check DialogueManager.currentActor and currentConversant:

Code: Select all

if (DialogueManager.currentActor == playerTransform || DialogueManager.currentConversant == playerTransform)
nicmar
Posts: 133
Joined: Wed Aug 21, 2019 2:39 am

Re: OnConversationEnd from DialogueManager.instance?

Post by nicmar »

Thanks!
I noticed that I had forgotten to add the player to the "base" of the dialog, the one that you see if you click the background. When I did that, it started to get a message.

Is that still required for this to work, meaning if I only have one person in the "base", and not the player, it's not sending anything to the player, even if he is part of the start node or other nodes as a conversant?
Working on SpaceChef - A wacky open world space western, featuring a chef with nothing to loose, after he loses everything.. ;) Follow our work on @BlueGooGames.
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: OnConversationEnd from DialogueManager.instance?

Post by Tony Li »

In this case, yes, you should assign the player transform. That's how the Dialogue System knows which GameObject is associated with the player.
Post Reply