Page 1 of 1
Random Node and avoid repetition
Posted: Fri Aug 19, 2016 8:45 am
by ricjonsu098
Hi. I was able to randomize the nodes based on the other threads posted here. (Thanks to that!)
But what I want to do is avoid repetition of a node.
For example: The player talked to NPC, NPC chooses node 1 dialogue. Then, whenever I talk to NPC again, NPC will not choose node 1 anymore.
I was thinking of placing a boolean variable in each of the nodes, then when a node is chosen, the variable will become true in that node but not in other nodes. Is this possible? If not, is there any other methods?
Re: Random Node and avoid repetition
Posted: Fri Aug 19, 2016 9:50 am
by Tony Li
Hi,
Variables (and/or quest states) are a good solution if you want to check only at specific branches. Use the
Script field to set variables, and the
Conditions field to check them. I'll sometimes include the actor's name in the variable name to help distinguish them, such as "Dancer_GaveAlibi", "Widow_AcceptedJob", "Bookie_GotNumbers", etc. Then you can use them like this:
Dancer conversation:
- Dancer: "What can I do for ya, detective?"
- Player: "Where were you on Saturday night?"
Conditions: Variable["Dancer_GaveAlibi"] == false
- Dancer: "Right here on this stage until dawn." [END]
Script: Variable["Dancer_GaveAlibi"] = true
- Player: "You said you were here until dawn. Then who made a call from your apartment at 9PM?"
Conditions: Variable["Dancer_GaveAlibi"] == true
- Dancer: "My cousin's staying with me for the week. What's it to ya?"
If you want to track the status of every dialogue entry, inspect your Dialogue Manager and tick
Include SimStatus. This uses about 20 bytes per dialogue entry, so if you have tens of thousands of lines of dialogue you probably don't want to tick this unless you really need it. This adds a string value Dialog[#].SimStatus for every dialogue entry, where # is the dialogue entry's ID number. (You can find the ID number by inspecting the dialogue entry.) The possible values of SimStatus are:
- "Untouched": Entry has never been spoken or shown in a player response menu.
- "WasOffered": Shown in a player response menu but not selected by player.
- "WasDisplayed": Spoken (by a player or NPC).
You can use it like this:
Dancer conversation:
- [1] Dancer: "What can I do for ya, detective?"
- [2] Player: "Where were you on Saturday night?"
Conditions: Dialog[3].SimStatus == "Untouched"
- [3] Dancer: "Right here on this stage until dawn." [END]
- [4] Player: "You said you were here until dawn. Then who made a call from your apartment at 9PM?"
Conditions: Dialog[3].SimStatus == "WasDisplayed"
- [5] Dancer: "My cousin's staying with me for the week. What's it to ya?"
If you decide to use SimStatus, on the Dialogue Manager's Input Settings there's a dropdown
Em Tag for Old Responses. You can change this from None to apply an
emphasis tag to player response entries that the player has already selected. Some games use this to remind players what responses they've already tried.
Re: Random Node and avoid repetition
Posted: Fri Aug 19, 2016 10:59 pm
by ricjonsu098
The first method cannot be applied on my case, because I'm having a quiz type dialogue, if I used it, once I set the variable to true, all of the nodes with the condition of variable=false will be affected, resulting for the conversation to end.
The second one does work(thanks!), but another problem came up. Once a dialogue was shown, its simstatus became WasDisplayed? I have a condition in a node like this (randomValue==0) and (Dialog[14].SimStatus=="Untouched"). And when it finishes randomizing, the conversation ends. I interpret this as the result of randomizing is 0, and the only conversation with randomvalue==0 is dialog[14].
I just can't create a node with a condition of (randomValue==0) and (Dialog[14].SimStatus=="WasDisplayed") and a dialogue text of "This question is already shown. Try again" because it ruins the quiz concept.
Currently I'm looking for a workaround by means of trial and error, but so far I think there is no workaround. If there is one, I would be glad, if there is none, I have no choice to stick with the solution I came up above this paragraph.
Re: Random Node and avoid repetition
Posted: Sat Aug 20, 2016 1:09 am
by ricjonsu098
Found a solution. I just have to create an empty node with a sequence of None() and a condition of (randomNum==0) and (Dialog[14].SimStatus=="WasDisplayed") and put a script randomNum=math.random(0,3) to it.
Basically, this solution randomizes a number again if randomNum=0, it keeps randomizing until it gets a number that isn't 0. That's all, thank you