How do I Get a Random NR not to repeat?

Get help using Construct 2

Post » Sat Jul 19, 2014 2:04 pm

Like i want to know how can i do like random repeater but... without repeating the nr's that allready where generated like.


i have allready made this with choose function
i made Choose(1,2,3,4,5) till like 32 and the only problem is i dunno how to make it not choose the nr's that allready where displayed
i know i would find some way but it would beee like in my logic hard and time consuming so i tought mybe u can help me ;)
B
3
Posts: 9
Reputation: 191

Post » Sat Jul 19, 2014 2:53 pm

ImageImageImage
B
71
S
21
G
220
Posts: 3,649
Reputation: 123,727

Post » Sat Jul 19, 2014 9:34 pm

kinda something different like how i can delete a nr thats already been used. in array

like lotery :D
B
3
Posts: 9
Reputation: 191

Post » Sat Jul 19, 2014 9:43 pm

This will do that. You set the size(32), call 'New scramble' and just index from 0 to 31, one at a time. Or, if you really want to remove, copy the values to a regular array and use Pop to remove them from the top.
ImageImageImage
B
71
S
21
G
220
Posts: 3,649
Reputation: 123,727

Post » Sat Jul 19, 2014 10:59 pm

You can also achieve the "random lottery" behavior without use of a third-part plugin.
See the attached and commented capx. It uses two arrays, but hopefully the comments will make it clear and simple enough.
You do not have the required permissions to view the files attached to this post.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
284
S
109
G
91
Posts: 7,317
Reputation: 87,483

Post » Tue Jul 22, 2014 2:39 pm

hmm not quite what i am looking for think... i need like a way to make something like usig dictionary wich can tell that some nr is already used and cant be used anymore or if like one animation is displayed it cant be displayed anymore i have made like pictures apear and animations change and each animation has its own nr
and the choose function chooses randomly from 32 nrs the one nr and then picture changes telling player what to do and i only need that when one picture is displayed it cant be displayed anymore or the nr cant be picked anymore by the choose system hope u know what i mean... ty all ;)
B
3
Posts: 9
Reputation: 191

Post » Wed Jul 23, 2014 2:15 am

okay i got that solved now :D and i have anither problem :D when i complite the lvl and restart they layout and start from beginning its throws the restart button right back again even if i restarted the layout and reset the variables..
B
3
Posts: 9
Reputation: 191


Return to How do I....?

Who is online

Users browsing this forum: ivanski1983, marcoscodas and 13 guests