Hi Tony,
sometimes i use the method "math.random(lower, higher)" in the node's script to calculate the next random node.
if i use math.random(0,30) its work fine, but if i use it with math.random(0,3) didnt work
do you know something with this issue?
thanks
lua issue?
Re: lua issue?
Hi Alfonso,
There shouldn't be a different between math.random(0,30) and math.random(0,3). Here are some things to check:
1. Is there an empty node between math.random() and the conditional nodes? (See here for an example.)
2. Are your conditions correct? Maybe one of your conditions is true too often or not often enough (e.g., "x > 0" instead of "x >= 0").
3. Temporarily set the Dialogue Manager's Debug Level to Info. This will tell you what conditions are true (Add Link) or false (Block on False Link).
4. You can watch the math.random() variable in the Dialogue Editor's Watches tab (at runtime) or get its value with the Lua Console.
There shouldn't be a different between math.random(0,30) and math.random(0,3). Here are some things to check:
1. Is there an empty node between math.random() and the conditional nodes? (See here for an example.)
2. Are your conditions correct? Maybe one of your conditions is true too often or not often enough (e.g., "x > 0" instead of "x >= 0").
3. Temporarily set the Dialogue Manager's Debug Level to Info. This will tell you what conditions are true (Add Link) or false (Block on False Link).
4. You can watch the math.random() variable in the Dialogue Editor's Watches tab (at runtime) or get its value with the Lua Console.
Re: lua issue?
well in each Conversation i have a variable called "Count", so every time the player speak to that conversation it increment in one the count.
in case i need a ramdon node, i just use this:
Script -> Conversation[ID].Count = math.random(0,3);
In child Nodes
Child 1 -> Conditions -> Conversation[ID].Count == 0
Child 2 -> Conditions -> Conversation[ID].Count == 1
Child 3 -> Conditions -> Conversation[ID].Count == 3
1º i never need the use of a node between randoms and conditions but i will check it, normally we use it the random in the start node and in a node group.
2º i think so, we are watching the count variable and is incrementing as normal one by one, it is like the random doesnt exist.
3º i will check with the debug
4º yes i watched it, is like only increment by one in the finish of the conversation, but not set it by a random.
in case i need a ramdon node, i just use this:
Script -> Conversation[ID].Count = math.random(0,3);
In child Nodes
Child 1 -> Conditions -> Conversation[ID].Count == 0
Child 2 -> Conditions -> Conversation[ID].Count == 1
Child 3 -> Conditions -> Conversation[ID].Count == 3
1º i never need the use of a node between randoms and conditions but i will check it, normally we use it the random in the start node and in a node group.
2º i think so, we are watching the count variable and is incrementing as normal one by one, it is like the random doesnt exist.
3º i will check with the debug
4º yes i watched it, is like only increment by one in the finish of the conversation, but not set it by a random.
Re: lua issue?
Is the ID in "Conversation[ID].Count = math.random(0,3);" correct?
Does the Console report any Lua errors? Maybe there's a typo, such as "Conversation[ID].Count = mathf.random(0,3);". (I make this mistake on occasion since Unity has a Mathf class.)
The debug should tell you what Lua statements run. You might see that the "Conversation[ID].Count = math.random(0,3);" is being skipped for some reason.
If you can reproduce this in a small project, please feel free to send it to tony (at) pixelcrushers.com. I'll be happy to take a look.
Does the Console report any Lua errors? Maybe there's a typo, such as "Conversation[ID].Count = mathf.random(0,3);". (I make this mistake on occasion since Unity has a Mathf class.)
The debug should tell you what Lua statements run. You might see that the "Conversation[ID].Count = math.random(0,3);" is being skipped for some reason.
If you can reproduce this in a small project, please feel free to send it to tony (at) pixelcrushers.com. I'll be happy to take a look.
Re: lua issue?
with the Log i have found the problem
it was a type error in the math.random, it was written correctly but when i delete it and he rewritten again start working fine again, i ask to the guy who write in the dialogue and he tell me that he use the copy&paste (he use mac) from other conversation, so i think it is possible that the copy&paste bring a rare char that make the error.

it was a type error in the math.random, it was written correctly but when i delete it and he rewritten again start working fine again, i ask to the guy who write in the dialogue and he tell me that he use the copy&paste (he use mac) from other conversation, so i think it is possible that the copy&paste bring a rare char that make the error.
Re: lua issue?
Glad you found the problem! 
