Temporary variables directly from the dialog

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
User avatar
Stalker_EG
Posts: 31
Joined: Sun Jul 07, 2019 7:57 pm

Temporary variables directly from the dialog

Post by Stalker_EG »

Good afternoon.
Please give an example of how the following can be implemented:

There are 2 choices:
1. Say what you saw.
2. Say you didn't see it.

If a player chooses to say what he saw, there is a dialogue that forces him to admit what he actually saw. I go back to the answer choice menu.
How do I not display what has already been selected? How do I hide the option that was selected earlier.
Can I create temporary variables directly from the dialog and then delete them?
Or perhaps there is a simpler solution.
Thank you in advance for your answer.
User avatar
Tony Li
Posts: 22886
Joined: Thu Jul 18, 2013 1:27 pm

Re: Temporary variables directly from the dialog

Post by Tony Li »

Hi,

Please see the Conversation Conditions Tutorial. It is very similar to your question.

Yes, you can create temporary variables. The Conversation Conditions Tutorial defines a variable in the Dialogue Editor's Variables section. This allows the editor to show it in dropdown menus:

Image

However, you can also manually type temporary variables there, too:

tempVariable.png
tempVariable.png (4.09 KiB) Viewed 1897 times

I think it's more convenient to define variables in the Variables section because you don't have to type after that, so it avoids typos.
SystemId
Posts: 32
Joined: Thu Aug 08, 2019 1:31 pm

Re: Temporary variables directly from the dialog

Post by SystemId »

This is a really old post, but I am running into a problem with temp variables today.
I have a lot of Characters that have multiple conversations on multiple scenes.
In some scenes, I want to use temporary variables to keep track of dialogue progress, because otherwise I would get flooded in variables if I was to make database ones for every scene.

I tried the method mentioned and added on the END node of a dialogue branch:
tempVariableA = true

into the Script of a dialogue Node, thinking this would create a temporary variable.

In another dialogue branch I had the condition:
tempVariableA == true

Where I assumed that after the first branch finished, it would start the second branch the next time you talked to the character. I must've misunderstood the instructions.
User avatar
Tony Li
Posts: 22886
Joined: Thu Jul 18, 2013 1:27 pm

Re: Temporary variables directly from the dialog

Post by Tony Li »

Hi,

That should work. Temporarily add a Lua Console component to your scene. Play the scene, and press ~+L to open Lua Console. Then enter "return tempVariableA" to see what the current value is.
SystemId
Posts: 32
Joined: Thu Aug 08, 2019 1:31 pm

Re: Temporary variables directly from the dialog

Post by SystemId »

Thank you, as you helped me understand what was going on.

The NPC conversation would start and it would default to the first dialogue branch because there were no conditions. At the end of that branch it would set the temp var=true and on the second dialogue branch, I had that var==true condition. What I forgot was that the first branch's condition was still empty, so it would still start off on the first branch if I talked to that NPC again.

Sorry, but can you advise me on what I should do, what condition should I set, so it will skip past the first dialogue branch after the first time talking to the NPC?
User avatar
Tony Li
Posts: 22886
Joined: Thu Jul 18, 2013 1:27 pm

Re: Temporary variables directly from the dialog

Post by Tony Li »

Hi,

You could set the first branch's Conditions to the line below to only use that branch if tempVariableA is not true:

Code: Select all

tempVariableA ~= true
Or you could change the order in the Links To: section so that the "tempVariableA == true" node is the first link in the list. It will use this node if the variable is true. Otherwise it will use the next node in the Links To: list.
Post Reply