You want to run a method during a conversation.

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
minomod
Posts: 89
Joined: Mon Jun 19, 2017 9:17 am

You want to run a method during a conversation.

Post 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?
Attachments
1.png
1.png (22.19 KiB) Viewed 388 times
User avatar
Tony Li
Posts: 21033
Joined: Thu Jul 18, 2013 1:27 pm

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

Post 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()
Post Reply