Showing a specific number of actors based on total actors
I want to show a specific number of certain actors based on total actors. For example i want to have 5 different actors lets say red,green,blue,black, and yellow. I want it to show a total of 10 of those actors but only lets say 3 of the red actor and the other 7 can be the other color actors but no more than 2 of each of the other colors. Thanks its a math problem that im stumped on.
Comments
3 red actors.
2 green actors.
2 blue actors.
2 black actors.
1 yellow actor.
Job done !
: )
Is there a prize ?
RRRGGBBWWYY
Then add additional actors in this order.
RGBWYRRGBW
RGBWYRRGBW
RGBWYRRGBW
RGBWYRRGBW
Check after the generation of each actor whether you have reached the required number if total actors, if you have then stop generating actors.
The colour is a red herring (no pun intended) - the numbers in any system can be ascribed any colour you like.
With the pattern RGBWYRRGBW make R G B W & Y attributes to which you can assign a random colour (randomized at the start if the process so R is always = to pink, G is always = to blue and so on).
Or more clearly C1 C2 C3 C4 C5.
"Also i need it to also be random on how many of the others show just no more than 2 of each though"
30% must alway be C1.
20% must always be C2.
20% must always be C3.
20% must always be C4.
20% must always be C5.
(with 10% being the lowest useable value)
So not random then ? : )
. . . . but only within that group of ten.
1) Randomly select a colour.
2) Do the following checks (these five checks produce just a single number)
. . . . . . . .
Is it C1 - if you already have 3 C1s then add (+1)%5 to this random number (otherwise go on to rule 3).
Is it C2 - if you already have 2 C2s then add (+1)%5 to this random number (otherwise go on to rule 3).
Is it C3 - if you already have 2 C3s then add (+1)%5 to this random number (otherwise go on to rule 3).
Is it C4 - if you already have 2 C4s then add (+1)%5 to this random number (otherwise go on to rule 3).
Is it C5 - if you already have 1 C5 then add (+1)%5 to this random number (otherwise go on to rule 3).
. . . . . . . .
3) Have there been 10 colours made so far, if there has been then reset all the check values for all C numbers to 0.
4) Generate next random number.
Lets say i have 5 of the same actor and i only want 3 random actors of those 5 to display a certain display message how would i do that.
Sorry, I didn't make that particularly clear.
Of the 5 colours - we are dealing with the one that you require 30% of - which here I have (arbitaraly) called C1.
So the "if you already have 3 C1s . . . . " simply checks whether you have enough of these already in this batch of 10 numbers.
If you do have enough C1s we need to select another number, adding +1 does what it says adds 1 to the random number (so 3 becomes 4 and 1 becomes 2)
But we don't want 5 to become 6 because we have no '6'.
So the addition of %5 tells Gamesalad that the world (of numbers) ends at 5 and after 5 simply loop around to 1.
Example:
Take a number (3) and keep adding (+1) = 4 5 6 7 8 9 10 11 12 13 14 15 16 17 . . . . . .
Take a number (3) and keep adding (+1)%5 = 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 . . . . . . .
Think of it as meaning 'loop after 5'. You can of course use any number you like, but in our example we want 5.
1) Randomly select an actor.
2) Check whether it is the right kind of actor.
4) Assign it a 'message'.
5) Stop after 3.
Did I really need to type that out !?!
: P
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
1) Randomly select an actor.
2) Check whether it is the right kind of actor.
4) Assign it a 'message'.
5) Stop after 3.
How can i check if its the right kind of actor in order to stop at 3. For example i have 5 of the same red actor when touch is pressed change 3 of those 5 actors to display a message and those 3 must be randomly selected from the 5 in total. Would i need self attributes to do this. Im not sure how the rules should be set up. Sorry for all the questions and also thanks for taking the time to respond.
"How can i check if its the right kind of actor in order to stop at 3"
1) Randomly select an actor.
2) Check whether it is the right kind of actor.
4) Assign it a 'message'.
5) what happened to step 3 ?
3) Oh!, there you are, you cheeky little thing.
99) Stop after you have assigned 3 'messages'.