Page 1 of 1

Continuance Problem

Posted: Sun Mar 03, 2019 1:44 am
by nivlekius
Hi again,
I have another issue. I'm sure there's a way to do it that I'm missing but I've been trying for hours and I decided to just go to bed and hope for an answer tomorrow or Monday. In any case, I'm trying to make it so that my conversation continues immediately after something happens in my c# script. Here an image then I'll explain.

Image

So, what I'm trying to do is, NPC gives PC a potion. He waits for the player to take the potion and then continues the conversation immediately. I don't want the player to have to leave the trigger then come back in. I've tried many combinations and I'm stumped at what to do.

so basically I need to know how to NPC Gives potion --> Player does whatever he wants --> my c# scripts keep checking if he used the potion --> player uses the potion --> conversation continues to next node without having to retrigger.

I'm sure it's something easy but I haven't been able to find it.

Thanks again,
Love the asset more and more as I use it.

-Niv

Re: Continuance Problem

Posted: Sun Mar 03, 2019 8:53 am
by Tony Li
Hi,

In your script, you can use DialogueManager.StartConversation() to start the conversation at a specific dialogue entry node ID. For example:

Code: Select all

DialogueManager.StartConversation("Balzac Conv", playerTransform, balzacTransform, 42);
Or, if you don't want to deal with ID numbers, you can create a second conversation. Let's say it's titled "Resume With Potion". In this conversation, link the START node directly to the node in the original conversation that you want to resume. Then start "Resume With Potion":

Code: Select all

DialogueManager.StartConversation("Resume With Potion", playerTransform, balzacTransform);
There's a third option that's a little different and has its own pros and cons. I'll put it in a spoiler block:
Spoiler
A third option is to keep the conversation running, link "Take this potion..." to the next node, and tell the sequencer to wait for a message from your script. Set the "Take this potion" node's Sequence to:

Code: Select all

WaitForMessage(TookPotion)
In your script, when the player takes the potion, use Sequencer.Message() to send that message:

Code: Select all

Sequencer.Message("TookPotion");
The advantage of this approach is that you don't have to restart a new conversation.

The disadvantages are:
  • You may need to release player control while this node is active, so the player can take the potion. Then you'll need to freeze player control again in the next node. You could use the SetEnabled() sequencer command for this.
  • If the player is free to move and simply walks away, you need to detect this and stop the conversation.

Re: Continuance Problem

Posted: Sun Mar 03, 2019 2:09 pm
by nivlekius
Thanks for the reply. Lots of good options and the dialogue number helped a lot. I still found that if the player moved out of the trigger area and came back in at certain points that it would either stop progression of the conversation or move too far ahead based on whether conditions were set to block or passthrough and the conditions that made them. So, I decided the best way to handle that was to keep the player from moving until he needed to (like when he tests his fighting skills).

So, since I already have a root spell implemented I simply called on PlayerController.rooted to lock or unlock him as needed. that seems to work very well. As you can probably tell this is a tutorial so it has a lot of steps and variables most quests probably won't have. So, while it's not completely as I had hoped it's working well enough and to my satisfaction. Especially since it's just a tutorial and it can be skipped anyway.

Thanks for the help

Re: Continuance Problem

Posted: Sun Mar 03, 2019 3:20 pm
by Tony Li
Glad to help! If you ever want to revisit some of it, just let me know.