Random selection

SANDEEP410SANDEEP410 Member Posts: 46
edited July 2012 in Working with GS (Mac)
I have 5 different values.I want to randomly select any1 value from those 5 values and assign it to an actor.
So how to use random function to get those values bec it accepts only min and max number

Comments

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273
    edited July 2012
    Create an integer attribute and name it.

    Then, you'll change attribute (or put it in a timer) and change that attribute to random(1,5)

    Then, you'll have to create a rule for each number like this:

    If attribute game.IntegerIJustCreated = 1,
    Do action


    If attribute game.IntegerIJustCreated = 2,
    Do action

    And so on.

    It would be much easier in a table, though. :)

    EDIT: Beat you to it, @ooi ;)
  • BarrytheBraveBarrytheBrave Member Posts: 134
    If your numbers are not sequential (so you can't use the min and max) then I'd say make another integer attribute called RND, and use the random function to set RND to a random number from min 1 to max 5, then have a rule saying if RND=1 then set value to (whatever value A is), etc.
Sign In or Register to comment.