How to randomly select a number without repetition?

How can i randomly select a number between 1 to 29 without repetition ?

Comments

  • stefdelecstefdelec Member, PRO Posts: 146

    Tips: a table with number from 1-29. row=random(1,29), then delete the row.

    copy-paste the table when you want to redistribute.

  • EpicoreGamesEpicoreGames Member Posts: 188
    edited September 2015

    i tried GSHelper's method but it doesn't work for me ...
    The reason i need to randomly select number 1 to 29 is because every number stands for a group , and i already set different positions for my actors in each group (it is called ENEMY in my game ) and when SPAWNER of ENEMY(i created another exact same actor of ENEMY but each group only has one , i call it SPAWNER ) passed certain position ( i set when enemyspawner.x is smaller than or equals to 289 ) then it will randomly select a number then that group will be spawned so that it looks like an endless game.

    Could someone tell me what should i do to make it randomly select a number without repetition?

  • EpicoreGamesEpicoreGames Member Posts: 188
    edited September 2015

    ENEMY and ENEMY SPAWNER picture for reference :
    [link deleted]

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    When you say something doesn't work, you really need to explain why. Did it not work because you couldn't replicate their method and so it just failed? Did it not work because even though you were able to replicate it, it didn't result in the numbers you wanted... and if so, why not?

    @stefdelec's method is basically what anyone else here would recommend to you. If it's not working or not making sense, give us a few more details and someone can suggest a fix.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • SocksSocks London, UK.Member Posts: 12,822
    edited September 2015

    @tatiang said:
    When you say something doesn't work, you really need to explain why.

    Yep, 'it didn't work' is the single most useless piece of feedback you can get in response to a suggested solution. It pretty much kills progress along a particular path.

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited September 2015

    Also, when I clicked on the link in your last post and then absent-mindedly clicked on an ad that looked like part of the image, it attempted to install a virus on my computer. A quick Google search for postimg.org turned up this discussion: http://www.bmwfanatics.co.za/showthread.php?tid=42996.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • EpicoreGamesEpicoreGames Member Posts: 188
    edited September 2015

    @tatiang sorry about that. I already deleted the link.

    Table doesn't work for me. As i mentioned before , all of the positions of the actors are preset . And i have 29 groups and each group holds 6 positions of the actors that will be spawned . So if i input those positions into a table , then there is no group anymore . And that method also can't limit how many actors it can spawn .

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited September 2015

    I'm still not understanding what the table and spawning has to do with selecting a number between 1 and 29. What you do with that number is a separate question, right? For example, you might have 29 rows of data with 6 columns -- or maybe 12 if you have 6 spawned actors -- each (for the positions). Then when you select a random number from 1 to rowCount(table), you use the row number in your following rules/spawning and then delete that row before again picking another random number.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • EpicoreGamesEpicoreGames Member Posts: 188

    Oh yah... Thanks for pointing that out . How can i redistribute the table when it is all used up?

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    To re-use the initial contents of the table, first copy the table to another table and then use the second table in your rules. When you need to reset things, copy the master table to the second table again.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • EpicoreGamesEpicoreGames Member Posts: 188

    I have set up the Copy Table , Remove Row , random pick number etc..
    But i noticed that it didn't roll all the numbers , it always gets stuck . I displayed the Picked Number and Row Count of the table . I noticed that it stop choosing number even though there are still 4,6 or even 7 rows left in the table.
    Why does that happen?
    I can provide additional information .

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    There's no way for me to know without seeing how your rules are set up. You can upload images or the project itself to a file-sharing site and then post the link here.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

Sign In or Register to comment.