Randomly choosing between 2 variables

0 favourites
  • 10 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • Here is the thing folks.

    I don't really know how to randomly choose between 2 variables in this form.

    I want that every from 10 to 60 seconds C2 chooses randomly between 2 variables that are listed here.

    Any advices please?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Use System.choose().

    var1 = choose(var2,var3)

  • Use System.choose().

    var1 = choose(var2,var3)

    Thank you blackhornet! But I am wondering where do i have to enter this code?

    I make a new variable which value will be set to trigger the var i need to randomize?

  • choose() in the manual is under system expressions. an expression in the white box that requests an input value. there are a lot of excellent and helpful expressions listed in the manual

    System.setvaribale

    [variable box]

    choose(var1, var2)

  • choose() in the manual is under system expressions. an expression in the white box that requests an input value. there are a lot of excellent and helpful expressions listed in the manual

    System.setvaribale

    [variable box]

    choose(var1, var2)

    I knew about choose and random but i was wondering where to put those

    now i see.

    I would like to have some sort of event which will let me tap code without creating more variables.

    But thanks i've got it. I will create a trigger variable triggering the 2 trigger variables :p

  • It doesn't work

    Where am I wrong?

    If BubbleRain_On=1 an event must happen but nothing happens.

    Is my choose correct? Can i put BubbleRain_ON=1 and expect it to take value 1?

  • Create a function called head or tails

    Variable Heads_Tails Set variable Choose(0,1)

    Now when you want to choose either call the function

    System compare two values heads_tails equal to 0 do this

    else

    do that

  • Create a function called head or tails

    Variable Heads_Tails Set variable Choose(0,1)

    Now when you want to choose either call the function

    System compare two values heads_tails equal to 0 do this

    else

    do that

    Thanks dude. The funny thing is that i figured it out just right now.

    Works

  • No Problem, the answer always comes at the end ha ha

  • I so know that feeling. I was once told that it's the dummy model. Where just talking about a problem out loud will help you solve the problem. These days I know talk out loud. I find my self requiring a lot less to ask on forums

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)