Help with tables
shmartybird
Member Posts: 17
Hey everyone. Been using GS for about 6 months and love it!
I'm working on a game where every time you steal from an actor, a rule randomly selects a table column to give you either: 0 bread, 1 bread, 2 bread. Currently, an actor is spawned (little loaf of bread) and fades out every time you steal.
The problem is: I want NO bread actor to spawn when 0 is randomly chosen; One bread actor to spawn when 1 is randomly chosen; and Two bread actors to spawn when 2 is randomly chosen from my table.
I just know there is a solution to this but I cannot figure it out. There are lots of actors too so I'm weary of creating lots of booleans...
Any ideas?
I'm working on a game where every time you steal from an actor, a rule randomly selects a table column to give you either: 0 bread, 1 bread, 2 bread. Currently, an actor is spawned (little loaf of bread) and fades out every time you steal.
The problem is: I want NO bread actor to spawn when 0 is randomly chosen; One bread actor to spawn when 1 is randomly chosen; and Two bread actors to spawn when 2 is randomly chosen from my table.
I just know there is a solution to this but I cannot figure it out. There are lots of actors too so I'm weary of creating lots of booleans...
Any ideas?
Comments
If you must use a table, you would still pick a random value but you would grab table values using game.randomNumber as your row number (and inside of a rule that makes sure game.randomNumber>0).
Edit: if you're using numbers other than 0, 1, and 2, you need to say so. I just realized that maybe your table contains values like 0, 1, 8, 12, etc. and you just wrote that as an example. The loop method I described will still work but I just added this comment because sometimes people try to simplify their questions and they instead obfuscate exactly what they need to know.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Thanks so much for the help tatiang. I've been playing about with this issue for days!!
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User