Page 1 of 1

OnConversationResponseMenu not called on actor

Posted: Wed May 11, 2016 11:23 am
by markmoyes
Hi -

I'm trying to execute some code when the response menu comes up, but my method (on the player object/actor) doesn't get called.

Code: Select all

using UnityEngine;
using System.Collections;
using PixelCrushers.DialogueSystem;

public class PlayerDialogController : MonoBehaviour {

	public void OnConversationStart(Transform Actor) {
		Debug.Log ("Player received conversationStart event");
	}

	public void OnConversationResponseMenu(Response[] responses)
	{
		Debug.Log ("Player received conversationResponseMenu event");
	}


}
OnConversationStart is triggered, the debug.log outputs fine. OnConversationResponseMenu never outputs the message when the menu appears.

We're using Actor Overrides to display the response menu in world space as a child of the player actor. Still, I thought the messages were sent to all actors and the Dialog Manager.

Any ideas?

One other question: Is it possible to 'bark' an arbitrary string? We're using

DialogueManager.Bark ("NPC Dies", gameObject.transform);

where "NPC Dies" is the name of a conversation... but it would be nice to be able to sometimes just fire off a string without creating a new conversation.

Cheers.

Re: OnConversationResponseMenu not called on actor

Posted: Wed May 11, 2016 1:15 pm
by Tony Li
Hi,
markmoyes wrote:Hi -

I'm trying to execute some code when the response menu comes up, but my method (on the player object/actor) doesn't get called.

Code: Select all

using UnityEngine;
using System.Collections;
using PixelCrushers.DialogueSystem;

public class PlayerDialogController : MonoBehaviour {

	public void OnConversationStart(Transform Actor) {
		Debug.Log ("Player received conversationStart event");
	}

	public void OnConversationResponseMenu(Response[] responses)
	{
		Debug.Log ("Player received conversationResponseMenu event");
	}


}
OnConversationStart is triggered, the debug.log outputs fine. OnConversationResponseMenu never outputs the message when the menu appears.

We're using Actor Overrides to display the response menu in world space as a child of the player actor. Still, I thought the messages were sent to all actors and the Dialog Manager.
OnConversationResponseMenu is only sent to the Dialogue Manager and its children. Can you move the method to a script on the Dialogue Manager, or add a Dialogue System Events component to the Dialogue Manager and hook it up to PlayerDialogController?
markmoyes wrote:One other question: Is it possible to 'bark' an arbitrary string?
Yes. The steps for versions up to 1.6.1.1 are in this post. In 1.6.2.2+, a new DialogueManager.BarkString() method wraps up those steps for you. (Please PM me your Unity Asset Store invoice number if you'd like early download access before it's 1.6.2.2 is available on the Asset Store in a few days.)

Re: OnConversationResponseMenu not called on actor

Posted: Thu May 12, 2016 10:33 am
by markmoyes
Ah, perfect. Hooking up the DialogSystemEvents component to the PlayerDialogController worked like a charm. Thanks!
(I'll PM you my invoice number to give 1.6.2.2 a try. Thanks Tony.)