Pick instance with UID (choose) didn't work

Get help using Construct 2

Post » Fri Oct 02, 2015 7:10 pm

I have 4 spritefont objects, i want to fill these objects with 3 random answers and 1 with the correct answer, i tried to use pick a random instance and didn't work, i tried now to use pick instance with UID and didn't work ( sometimes 1 or 2 spritefont objects are empty without text and without the boolean true) , i tried to set a random number in a variable (1 to 4) to each spritefont but didnt work too because the number repeat byself and i dont know how to avoid this, i want to use different positions to the answers each time i call the function. please help!

Image


why? :(

Image
B
9
S
3
Posts: 142
Reputation: 1,108

Post » Fri Oct 02, 2015 9:07 pm

You need to iterate through all of them is my guess, try the system=>For Each, this will let you iterate forwards or backwards IIRC.

In my poor English, this will make a "Loop", and loop through each of them so you can do your compare on a 1 by one basis rather than all in one shot.
B
29
S
8
G
4
Posts: 767
Reputation: 5,985

Post » Fri Oct 02, 2015 9:16 pm

You can use the RandomArray plugin to get four random indices. From there you can pick though various means, one being "Pick nth instance".

viewtopic.php?f=147&t=152763&p=963980#p963980
ImageImageImage
B
71
S
22
G
241
Posts: 3,734
Reputation: 134,494

Post » Sat Oct 03, 2015 10:10 pm

blackhornet wrote:You can use the RandomArray plugin to get four random indices. From there you can pick though various means, one being "Pick nth instance".

viewtopic.php?f=147&t=152763&p=963980#p963980


if i have a list of 1000 words is not more easy to make something like this?

Image

This is working to me, with random the probabilities of get the same word in the answer are 1 in 1000? , even if i use the RandomArray how i can put the correct answer in those sprite fonts?
Last edited by Majinboo on Sat Oct 03, 2015 11:41 pm, edited 3 times in total.
B
9
S
3
Posts: 142
Reputation: 1,108

Post » Sat Oct 03, 2015 10:59 pm

check this capx

4Answers.capx
B
66
S
24
G
7
Posts: 1,514
Reputation: 11,039

Post » Sun Oct 04, 2015 9:28 pm

korbaach wrote:check this capx

4Answers.capx


Amazing!! Thank you so much for your help!!!!!!!!! i spend the whole day analyzing your capx and modifying it, please give me a little hand with this little issue, i am trying to use a loop to not show the questions that you responded with two good answers however i cant get the second answers to work because some answers repeat in the four spritefonts (this didn't happen in the first answers, your original function) and if the loop doesnt finds an unanswered question in the array how can I put a test that says "no questions left"?, the idea is to show the questions with one bad answer again at the end of the round and don't show again the questions with the 2 good answers responded.

I tried to replicate the your original function but didn't worked, i don't know why
Image

Image

http://www.filedropper.com/4answersv2
B
9
S
3
Posts: 142
Reputation: 1,108

Post » Sun Oct 04, 2015 9:55 pm

a small error in event 16
Image

Image
B
66
S
24
G
7
Posts: 1,514
Reputation: 11,039

Post » Mon Oct 05, 2015 3:59 am

korbaach wrote:a small error in event 16
Image

Image


lol, i recheck for 1 hour the events and didn't see that. thank you so much for your help!! :)
B
9
S
3
Posts: 142
Reputation: 1,108


Return to How do I....?

Who is online

Users browsing this forum: Armench and 15 guests