How do I have the text say something random?

Get help using Construct 2

Post » Mon Aug 06, 2012 7:48 am

I have 10 different words/quotes and every time I go to a layout, I want it to randomly pick which one to say. How would I do that? I don't know how to make construct choose something randomly.
B
3
Posts: 2
Reputation: 279

Post » Mon Aug 06, 2012 8:14 am

use the 'choose' expression, it randomly returns one out of however many strings
set text to choose( text1, text2, text3, etc)
B
28
S
8
G
1
Posts: 469
Reputation: 4,683

Post » Mon Aug 06, 2012 8:31 am

Thanks. It works fine, but how would I make it stay at one word?

I have this:


[Text Object]Word ---> Is visible ---> [T] Set Text to choose("text1", "text2", "text3")

This just makes it cycle through all of the words.


EDIT
Nevermind just figured it out. For future reference I just made a variable equal to 0. When the layout is visible I just checked if the variable was equal to zero and made it equal to one.

As for the text, I just added another condition to check if the variable is equal to zero.

Thanks again.blankface2012-08-06 08:48:49
B
3
Posts: 2
Reputation: 279

Post » Mon Aug 06, 2012 9:04 am

You could also put it in a group and disable the group at the end of the event. :)
B
36
S
10
G
6
Posts: 948
Reputation: 11,101


Return to How do I....?

Who is online

Users browsing this forum: jul, TELLES0808, Yahoo [Bot] and 22 guests