Forums › 💬 NodeCanvas › ⚙️ Support › [DialogTree] Accessing actors on Multiple Choice Node › Reply To: [DialogTree] Accessing actors on Multiple Choice Node
Hey,
Indeed the MultipleChoiceRequestInfo does not contain the IDialogueActor that is selected in the node. I just added this now.
If you want to add it as well, please make the following changes:
1) In MultipleChoiceNode.cs, change line #70 to the following:
|
1 2 3 |
var optionsInfo = new MultipleChoiceRequestInfo(finalActor, finalOptions, availableTime, OnOptionSelected); |
2) In DialogueEventArguments.cs, change class MultipleChoiceRequestInfo to the following:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
///Send along with a OnMultipleChoiceRequest event. Holds information of the options, time available as well as a callback to be called providing the selected option public class MultipleChoiceRequestInfo{ ///The actor related. This is usually the actor that will also say the options public IDialogueActor actor; ///The available choice option. Key: The statement, Value: the child index of the option public Dictionary<IStatement, int> options; ///The available time for a choice public float availableTime; ///Should the previous statement be shown along the options? public bool showLastStatement; ///Call this with to select the option to continue with in the DialogueTree public Action<int> SelectOption; public MultipleChoiceRequestInfo(IDialogueActor actor, Dictionary<IStatement, int> options, float availableTime, bool showLastStatement, Action<int> callback){ this.actor = actor; this.options = options; this.availableTime = availableTime; this.showLastStatement = showLastStatement; this.SelectOption = callback; } public MultipleChoiceRequestInfo(IDialogueActor actor, Dictionary<IStatement, int> options, float availableTime, Action<int> callback){ this.actor = actor; this.options = options; this.availableTime = availableTime; this.SelectOption = callback; } } |
Let me know if that works for you.
Thanks!
