[Solved] Dialogue -> Conversations // Doubt!

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Japtor
Posts: 120
Joined: Thu Jun 28, 2018 1:41 pm

[Solved] Dialogue -> Conversations // Doubt!

Post by Japtor »

Hi all,

Inside the Dialogue -> Conversations... Is there any possibility to, for example, active a game object from the scene when reached a certain part of the dialogue?

Thanks,
Javier.
Last edited by Japtor on Wed Jul 11, 2018 3:29 am, edited 1 time in total.
User avatar
Tony Li
Posts: 22058
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dialogue -> Conversations // Doubt!

Post by Tony Li »

Hi Javier,

Yes, use the SetActive() sequencer command in the Sequence field.

For example:
  • Dialogue Text: "Activating the force field."
  • Sequence: {{default}}; SetActive(ForceField)
The "{{default}}" keyword tells the dialogue entry node to play the default sequence defined on the Dialogue Manager.

The SetActive(ForceField) command finds a GameObject named "ForceField" and activates it. This GameObject should have a parent GameObject that is active.
Japtor
Posts: 120
Joined: Thu Jun 28, 2018 1:41 pm

Re: Dialogue -> Conversations // Doubt!

Post by Japtor »

Hi,

Thanks for the answer :)

And what about if, for example, the object that I would like to active has attached a script which has a public variable of type int. It is possible to set it via Dialogue -> Conversation?

Thanks,
Javier.
User avatar
Tony Li
Posts: 22058
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dialogue -> Conversations // Doubt!

Post by Tony Li »

Yes. Here are three different ways. You can choose the one you prefer.

1. Add a method to set the int. The method must accept a string parameter. For example:

Code: Select all

public int myVariable;

public void SetInt(string value)
{
    myVariable = System.Convert.ToInt32(value);
}
Then use the SendMessage() sequencer command:

Code: Select all

{{default}};
SetActive(ForceField);
SendMessage(SetInt, 99, ForceField)

2. Or write a custom sequencer command.


3. Or register a Lua function and use it in the Script field (not the Sequence field like the above 2 options).
Japtor
Posts: 120
Joined: Thu Jun 28, 2018 1:41 pm

Re: Dialogue -> Conversations // Doubt!

Post by Japtor »

Hi,

Ok, I will try one of them. Thanks for answering! :)

Regards,
Javier.
Post Reply