Page 1 of 1

You want to run a method during a conversation.

Posted: Tue Oct 24, 2017 12:22 am
by minomod
1. A.Script has a method called B () in the script.
2. I want to execute the method called B () in the middle of the dialogue.

Q. What should I do with the attached image?

Re: You want to run a method during a conversation.

Posted: Tue Oct 24, 2017 9:20 am
by Tony Li
Hi,

The "quick and dirty" solution is to use the SendMessage sequencer command. Let's say the script is on a GameObject named "MyGameObject". Set the Sequence field to:

Code: Select all

SendMessage(B,,MyGameObject);
{{defaultsequence}}
The command SendMessage(B,,MyGameObject) finds the GameObject named "MyGameObject" and calls the B() method on its scripts. The {{defaultsequence}} keyword adds the Dialogue Manager's Camera Settings > Default Sequence.

A more robust solution is to register B() as a Lua function. The Scripts/Templates folder contains a starter template for a script that you can use to register your function. Then you can set the Script field to:

Code: Select all

B()