Basically I want to generate a serie of 4 integers all being different. From 0 to 3. For instance 1,2,0,3 OR 3,2,0,1 etc… Those numbers will be colors for my players. Then I have PlayerLeft.color and so on (top, bottom, right)…
My algo is basically the following
Generate CurrentRandom = Random(3)
PlayerLeft.color = CurrentRandom
While CurrentRandom = PlayerLeft.color do CurrentRandom = Random(3)
Once then different PlayerRight.color = CurrentRandom
While (CurrentRandom == PlayerLeft.color || CurrentRandom == PlayerRight.color) do CurrentRandom = Random(3)
And so on…
My guess is that I am NOT using well the While True Event of GD…
Here is a screen capture. Can someone tell me what I am doing wrong there ?
NOTE : I tried in conditions using Variable = Variable and also Evaluation of two variables ; seems to be the same.
Sorry. I was confused between While Event and Trigger Once while true.
I found While Event using the PLUS on top right to insert a loop.
Still I have a problem with generating my serie 0,3,2,1 for instance with random(3).
I thought of using an inventory but still hasItem can result in a while loop very consuming if it happens that the function doesn’t get back a number not yet used.
The algo you described above seems right, but maybe you did a mistake somewhere
Use a text object to display the picked values, it should help you troubleshoot.
I gave up this path because even with a “While … true” loop comparing my new value with already set ones, I cannot understand why, but I manage to get SAME values !! For instance 0,1,0,3 or whatever…
As I want to go forward I decided to give player the possibility to swap boards which in the end IS NOT RANDOM but will allow to have several game configuration…
I sometimes feel disappointed when I start a new tech as GD and feel I am doing the thing right but a problem comes up at every step !! Anyway ! I’ll muddlethrough !