Continuing my quest to the "perfect multiplayer dialog", I have a new question about RandomNum.
This function give a Random number between 0 and Range, and test if value match.
What I would like to know, is about multiple calls :
IF RandomNum(9,0) THEN 0 END
IF RandomNum(9,1) THEN 1 END
IF RandomNum(9,2) THEN 2 END
IF RandomNum(9,3) THEN 3 END
IF True() THEN 4 END
As a C programmer, I would say that RandomNum will be reevaluated each time, so considering each time we have 10 possible choices and only one that good :
We have 0.1 chances to go in the first statement (0)
We have 0.9*0.1 chances to go the second statement (1)
We have 0.9*0.9*0.1 chances to go the third statement (2)
We have 0.9*0.9*0.9*0.1 chances to go the fourth statement (3)
And 0.9*0.9*0.9*0.9 chances for the True statement
The chances are 10% / 9% / 8.1% / 7.29% / 65,61% (if I'm not wrong with my maths;))
As you can see it there are a big chance for the True statement to be choosen (I assume that I added a fifth statement I would have been around 55%)
That is only if RandomNum pick up a random Int each time it is called.
Now I would like to know : How to have an equal probability for the four statement (ie: 10% each) without doing maths ? (ie: I use a trick)
For the moment, my dialog plus the condition i used always resume in the default choice, and that is particuliary ... annoying.
[edit] If I read
http://www.gibberlings3.net/iesdp/scripting/bg2triggers.htm I see that RandomNum give a number between 1 and Range, and 0 and Range in the Scripting Quick Ref (in script compiler of nwn) ... ?