Page 1 of 1

OnConversationEnd from DialogueManager.instance?

Posted: Tue Jan 19, 2021 4:23 pm
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();
	}
}

Re: OnConversationEnd from DialogueManager.instance?

Posted: Tue Jan 19, 2021 6:16 pm
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)

Re: OnConversationEnd from DialogueManager.instance?

Posted: Wed Jan 20, 2021 2:51 am
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?

Re: OnConversationEnd from DialogueManager.instance?

Posted: Wed Jan 20, 2021 9:02 am
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.