5 of the same actor's choose a random number from 1,7 but pick different numbers.

KillerPenguinStudiosKillerPenguinStudios Member Posts: 1,291
edited December 2014 in Working with GS (Mac)

Hello all,

I am banging my head against the wall as I can not figure this out for the life of me. I have an actor that I want to display a text. The text displayed is dependent on which number from 1-7 is chosen. (If random number is 1, display this. If random number is 2, display that and so on.) I put the actor in the scene and duplicate it 5 times so that there are 6 of the same actor on the scene. I want them all to choose a random number from 1-7 but if any of them choose the same number they will choose a different number until each of the 6 has it's own number. There is a next button and when that button is pressed this process will run again.

Hopefully this makes since. LOL Thanks in advance!

Comments

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273

    Check out one of my latest video tutorials on gshelper YouTube channel. I show you how to do this very thing. On mobile now, so cannot grab link easily.

  • colandercolander Member Posts: 1,610

    Try creating a table with 7 rows and number the first column 1 to 7. Before you run your random routine copy the table. When you run your random routine start with random(1,tableRowCount(TableCopy)) then use the Add/Remove Row action and the delete the row chosen by the random number.

    It should work if it doesn't it may be because GS is running them at the same time. You could try spawning where you can control the flow.

  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    edited December 2014

    you can also fake it, which takes some of the computation load off of GS. Go to random.org and generate a bunch of integer sets. Drop it into a table and just interate through that.

    For example, I generated 999 sets of numbers 1-7, here is a small sample:

    2, 4, 6, 3, 5, 1, 7
    5, 7, 4, 6, 3, 1, 2
    1, 5, 7, 4, 3, 2, 6
    6, 4, 7, 1, 2, 3, 5
    5, 7, 6, 3, 4, 2, 1
    6, 7, 1, 4, 3, 2, 5
    4, 2, 6, 1, 7, 5, 3
    6, 5, 1, 4, 3, 2, 7
    2, 1, 5, 6, 7, 3, 4
    3, 6, 4, 2, 1, 5, 7
    3, 4, 1, 6, 5, 7, 2
    7, 1, 4, 2, 3, 5, 6
    4, 5, 1, 7, 2, 3, 6
    5, 1, 2, 7, 3, 6, 4
    2, 1, 3, 5, 7, 4, 6
    7, 2, 6, 4, 1, 3, 5
    3, 2, 5, 7, 1, 6, 4
    2, 6, 4, 5, 1, 7, 3
    2, 3, 4, 6, 5, 1, 7
    3, 2, 4, 7, 5, 6, 1
    5, 4, 6, 2, 3, 1, 7
    5, 1, 7, 2, 4, 6, 3
    7, 5, 3, 4, 2, 1, 6
    3, 2, 5, 7, 6, 4, 1
    2, 7, 1, 4, 5, 3, 6
    7, 3, 5, 2, 6, 4, 1
    7, 5, 1, 4, 6, 3, 2
    7, 4, 2, 6, 5, 1, 3
    6, 1, 4, 5, 7, 3, 2
    2, 4, 1, 7, 5, 6, 3
    1, 5, 6, 7, 4, 3, 2
    3, 7, 4, 2, 1, 5, 6
    5, 2, 3, 4, 6, 1, 7
    2, 1, 4, 3, 6, 7, 5
    5, 1, 2, 4, 6, 7, 3
    3, 2, 6, 4, 5, 1, 7
    1, 5, 6, 3, 7, 2, 4
    

    as you can see each sent is unique. So all you do is increment which row the actors should be looking at, and they all look at their own column.

    I've done this in a ton of my games

  • KillerPenguinStudiosKillerPenguinStudios Member Posts: 1,291

    @Braydon_SFX said:
    Check out one of my latest video tutorials on gshelper YouTube channel. I show you how to do this very thing. On mobile now, so cannot grab link easily.

    Hey Braydon,

    Thanks for the reply! So I checked out your "How To Spawn Random, Non-Repeating Actors tutorial" and got it working pretty well for what I need it to do. My only question for you is, how would I go about having basically a refresh button in the scene and when pressed it re-runs it. Basically when you pressed the reset button it gave the actors a different choice. What to do the same thing but with with a button in the scene. I've been trying to get it to work properly the last 2 days but no luck. Thanks in advance!!!

Sign In or Register to comment.