Spawn Random Actor /w table and different frequency

Hello there!
We´re new to Gamesalad and planing to make our first game, I guess we upgrade to the Pro Version soon.

But for now I have the following Problem:
At the moment I work with a "Spawner"-actor and a random number to spawn my actors in the scene. My Problem is
that I have a lot of different actors I want to spawn randomly and I would like to prefere to work with a table (or array?)
insteat of countless if/else conditions.

Another Problem: I would like to spawn some actors more often than other, I realy dont have any good idea for that atm.

Thanks for the help,
GameStock Studio

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Tables are great for spawning random actors. Place a unique value (e.g. number of name) in each row. Then do what I described here: http://forums.gamesalad.com/discussion/comment/443953/#Comment_443953

    You'll need one rule for each table value that spawns an actor based on the chosen value.

    As far as frequency goes, you could consider placing more of some values so that the odds are greater:

    1
    2
    2
    2
    3
    3
    4
    4
    4
    4

    In the table above, actor 1 has a 10% chance of spawning, actor 2 has a 30% chance, etc.
  • GameStock StudioGameStock Studio Member Posts: 3
    Thanks for the quick answer. Had the same idea for the frequency so I definitly will try this.

    Im not familar with tables yet but I´ll test it tomorrow and give some feedback - sounds good so far!
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    If you are just concerned about frequency and don't care if a random choice ever repeats, then no need to delete rows from the table.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Here's a demo I made for you.
  • GameStock StudioGameStock Studio Member Posts: 3
    Big thanks for the support helped me a lot!

    I kinda love working with tables, I also use it for other values now - great way to balance the game.

    again thanks for the good and quick answer. Problem is solved.
Sign In or Register to comment.