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
39
S
12
G
8
Posts: 580
Reputation: 7,108

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
79
S
24
G
52
Posts: 4,725
Reputation: 39,713


Return to How do I....?

Who is online

Users browsing this forum: suicidenutella, Vallar and 0 guests