Clever Choose

Get help using Construct 2

Post » Sun Oct 21, 2012 5:58 pm

With the Choose("1","2","3") Command, is it possible to set it up so that it never repeats the same thing multiple times in a row?
B
43
S
13
G
8
Posts: 612
Reputation: 7,372

Post » Sun Oct 21, 2012 7:32 pm

You could do something like this:

every tick
   set oldval to var
   set var to Choose("1","2","3")

while
var=oldval
   set var to Choose("1","2","3")



You could also do the following:
variable choices="1,2,3,"
variable value="1"

set value to tokenat(replace(choices, value & ",", ""),int(random(tokencount(choices,",")-2)),",")
B
91
S
31
G
99
Posts: 5,197
Reputation: 65,680


Return to How do I....?

Who is online

Users browsing this forum: Hiddendanger, plinkie and 5 guests