Hello, I'm making a randomizing system like this:
The player reaches a point in the conversation with an NPC involving a group Node with a number of branches. After the player goes through every branch at least once, I want the conversation to transition into a math.random between all branches.
How can I do that? My original line of thought was to make a local variable and change it every time a branch ends, and after it reaches the highest possible value, make the dialogue go through a separate Node with math.random.
Checking if the player went through all branches
Re: Checking if the player went through all branches
That'll work. Let's say you have 3 nodes: A, B, C. You could define a variable "branchesVisited" initially set to zero. Then set up the nodes like this:
EDIT: Updated conditions.
- Group Node linked to A, B, C: Condition: branchesVisited==3, Script: RandomizeNextEntry()
- A: Condition: branchesVisited==0 or branchesVisited == 3, Script: branchesVisited=1
- B: Condition: branchesVisited==1 or branchesVisited == 3, Script: branchesVisited=2
- C: Condition: branchesVisited==2 or branchesVisited == 3, Script: branchesVisited=3
EDIT: Updated conditions.
Re: Checking if the player went through all branches
Hi, Tony! Thanks for the reply!
I ran a few tests and I think that this way only works if I wanted to randomize between nodes located after the branches in question. What I want to do is actually rerun the branches, like this:
The Group Node is supposed to randomize between the branches below it after going through them all at least once. I tried setting a different variable for this, but right now the only solution I can see is making two group nodes - one that gives the branches a pass before they are all read and then another one that acts as the randomizer, after branchesVisited is equal to the number of branches.
I ran a few tests and I think that this way only works if I wanted to randomize between nodes located after the branches in question. What I want to do is actually rerun the branches, like this:
The Group Node is supposed to randomize between the branches below it after going through them all at least once. I tried setting a different variable for this, but right now the only solution I can see is making two group nodes - one that gives the branches a pass before they are all read and then another one that acts as the randomizer, after branchesVisited is equal to the number of branches.
Re: Checking if the player went through all branches
Good point. I updated the conditions in my previous reply. I think that should work the way you want.
Re: Checking if the player went through all branches
Thanks! That solved it - at least for now, I think.
Re: Checking if the player went through all branches
Sound good! If you come up with any cases that you'd like to handle that the current conditions don't handle, just let me know.