How do I randomly generate specific numbers?

0 favourites
  • 4 posts
From the Asset Store
A procedurally generated infinite runner in 3D for Construct 3!
  • I have a waypoint system set up I would like to do, to move enemies around, without the pathfinding behavior.

    When they collide with specific waypoints, it will change their direction based on a number value.

    The problem is, I don't want it to always choose all 4 random numbers. Sometimes, I would want it to pick a random number out of 2 numbers, or 3 numbers, so how would I do that?

    I know how to randomly generate the 4 numbers, but what would I do if I wanted it to set it to either 0, or 2? Or 1 and 4, or 0,1 and 4?

    thanks!

  • Try choose(n0,n1,n2), or just use int(random(4)) would get 0-3 which you can reference 0 do this, 1 do foo, etc.

  • two different options (event 1 or events 2 and 3)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • . The problem is, I don't want it to always choose all 4 random numbers. Sometimes, I would want it to pick a random number out of 2 numbers, or 3 numbers, so how would I do that?

    I know how to randomly generate the 4 numbers, but what would I do if I wanted it to set it to either 0, or 2? Or 1 and 4, or 0,1 and 4?

    thanks!

    use instance variables for enemy..

    var=1 ..choose(1,4)

    var=2 ..choose(0,3)

    ...........

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