So I decided to once again try to make something with CF2.5 but keep getting stumped by what should be very easy to do.
I have an active object and at start of frame I want to set one of its variables to randomly be -1 or 1 but I can't find a way to do this.
Why is there no "choose(x1, x2, x3....) function?
How to set a variable randomly to -1 or 1, can't find choose function
Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.
A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.
Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!
Clickteam.
A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.
Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!
Clickteam.
-
-
You could try setting the variable to something like this: RRandom( - 1, 0 )
Then, if necessary, set the variable to 1 if its random value = 0.
-
You could try setting the variable to something like this: RRandom( - 1, 0 )
Then, if necessary, set the variable to 1 if its random value = 0.
That would not make it a 50/50 chance but rather 33/66 wich is not acceptable, thanks for answering though
-
Hello,
Just do Random(2)*2-1 and you should get either -1 or 1. -
Hello,
Just do Random(2)*2-1 and you should get either -1 or 1.Thank you
-
That would not make it a 50/50 chance but rather 33/66 wich is not acceptable, thanks for answering though
RRandom( - 1, 0 ) would be a 50/50 chance. The result would give either -1 or 0. If it was RRandom( - 1, 1 ), then yes. It would be a 1 in 3 chance: -1,0,1.
Windlakes solution is definitely better for what you need though.
-
RRandom(0, 1)
Equal 0 -> Set to -1 -
Hello,
Just do Random(2)*2-1 and you should get either -1 or 1.
Thanks, is great for random direction setting! -
Just do Random(2)*2-1 and you should get either -1 or 1.
very clever 1 line event
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!