Set Random w/no Repeats (no duplicates )

Get help using Construct 2

Post » Fri Apr 17, 2015 6:17 am

Hi
I currently have a question/answer game and it is set up as (eg) : Set int(random(0,4)) ,
---- obviously the game has more than 5 questions -- but for simplicities sake, ---------
anyway
so the game picks one number ( and the game sets the frame, and asks the question. )
the problem arises when the player is near the end of the game
and is repeatedly being asked the same questions over and over.

I would like it so that there is no repeats or duplicates .

I have been working with a basic capx.

My thought process is:
The game would Set a temp_random number and check against a 'line up' of other numbers to test if they
have already been played (AlreadyRan), and if yes, then 'run again' ( run the Set int(random(0,4)) again )
but if not 'Already Ran', then set the number and tag that number already played.
My problem arises when I try to reloop after a duplicate number is detected...

I have trying to figure it out on a capx but it just doesn't want to work....

any idea's?

Thanks for looking and thanks for your help,
much appreciated.
Last edited by producermark11 on Sun Apr 19, 2015 2:15 am, edited 1 time in total.
B
36
S
10
G
4
Posts: 250
Reputation: 7,963

Post » Fri Apr 17, 2015 6:30 am

Last edited by korbaach on Fri Apr 17, 2015 6:50 am, edited 1 time in total.
B
67
S
24
G
7
Posts: 1,518
Reputation: 11,072

Post » Fri Apr 17, 2015 6:39 am

@korbaach
Thanks I will take a look.
Yes that will work.
Now I just have to figure out Arrays :-p
B
36
S
10
G
4
Posts: 250
Reputation: 7,963

Post » Sun Apr 19, 2015 4:00 pm

Hi
So with permission of korbaach, I have broken down the capx above ( I made a barebone version if you will )
and made a tutorial
https://www.scirra.com/tutorials/1440/s ... duplicates
B
36
S
10
G
4
Posts: 250
Reputation: 7,963


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 7 guests