Discuss Scratch
- Toasty_Boy
-
100+ posts
How do i randomize costumes?
Hey, I was wondering how to randomize costumes so that it will also broadcast something when that number is triggered. What I have so far is this.

But this isn't working. All help is appreciated.

- gor-dee
-
1000+ posts
How do i randomize costumes?
Can you explain a bit more. do you want a different broadcast for each fish? When do you want the broadcast to happen?
- Toasty_Boy
-
100+ posts
How do i randomize costumes?
So I want it to broadcast “Caught Fish” so that it will show a shining ring around the caught fish. And I want it to happen when if the “Fish” variable is below say 700.
Last edited by Toasty_Boy (Jan. 28, 2017 21:49:04)
- Toasty_Boy
-
100+ posts
How do i randomize costumes?
But I want it to be less common for certain costumes.
- ShadowPheonixRPs
-
100+ posts
How do i randomize costumes?
make duplicate costumes maybe? More of costume (a) then (b) and then (a) will appear more often. But I want it to be less common for certain costumes.
- Toasty_Boy
-
100+ posts
How do i randomize costumes?


- ShadowPheonixRPs
-
100+ posts
How do i randomize costumes?
your welcome! I know its not the best way but it is the only way I can think of.That might work, but I also want to make it efficient too. Thanks for the suggestion though.
![]()

- SBissay
-
500+ posts
How do i randomize costumes?
You could make a list with the combined probabilities of each costume.
Explanation : let's say you want costume 1 to be here 25% of the time, costume 2 : 30 %,costume 3 : 44% and costume 4 is the super shiny appearing 1% of the time.
Then, you'll have in your list : (25 ; 55 ; 99 ; 100).
(55 = 25 + 30; 99 = 25 + 30 + 44 ; 100 = 25 + 30 + 44 + 1)
From there, you just have to pick a random number between 1 and 100 and test which list item is higher than your random number :
Explanation : let's say you want costume 1 to be here 25% of the time, costume 2 : 30 %,costume 3 : 44% and costume 4 is the super shiny appearing 1% of the time.
Then, you'll have in your list : (25 ; 55 ; 99 ; 100).
(55 = 25 + 30; 99 = 25 + 30 + 44 ; 100 = 25 + 30 + 44 + 1)
From there, you just have to pick a random number between 1 and 100 and test which list item is higher than your random number :
Last edited by SBissay (Jan. 28, 2017 22:12:25)
- asivi
-
1000+ posts
How do i randomize costumes?
Edited
Please share the project.
Please share the project.
Last edited by asivi (Jan. 29, 2017 12:03:06)
- Toasty_Boy
-
100+ posts
How do i randomize costumes?
combined probabilities of each costume.What is the “+ 0” there for. You could make a list with the
Explanation : let's say you want costume 1 to be here 25% of the time, costume 2 : 30 %,costume 3 : 44% and costume 4 is the super shiny appearing 1% of the time.
Then, you'll have in your list : (25 ; 55 ; 99 ; 100).
(55 = 25 + 30; 99 = 25 + 30 + 44 ; 100 = 25 + 30 + 44 + 1)
From there, you just have to pick a random number between 1 and 100 and test which list item is higher than your random number :
- deck26
-
1000+ posts
How do i randomize costumes?
It makes sure the value is treated as a number rather than text - it can make a difference.combined probabilities of each costume.What is the “+ 0” there for. You could make a list with the
Explanation : let's say you want costume 1 to be here 25% of the time, costume 2 : 30 %,costume 3 : 44% and costume 4 is the super shiny appearing 1% of the time.
Then, you'll have in your list : (25 ; 55 ; 99 ; 100).
(55 = 25 + 30; 99 = 25 + 30 + 44 ; 100 = 25 + 30 + 44 + 1)
From there, you just have to pick a random number between 1 and 100 and test which list item is higher than your random number :
- SBissay
-
500+ posts
How do i randomize costumes?
It's a typo : it's
The goal is to start with your first costume, and “upgrade” it if your random number is greater than the current list entry.
The goal is to start with your first costume, and “upgrade” it if your random number is greater than the current list entry.
Last edited by SBissay (Jan. 28, 2017 22:36:37)
- Toasty_Boy
-
100+ posts
How do i randomize costumes?
I don't think i'm up to that level yet in coding. I'm also not very familiar with lists yet, and how to use them in advanced code. But your help is very appreciated. Thank you.combined probabilities of each costume.What is the “+ 0” there for. You could make a list with the
Explanation : let's say you want costume 1 to be here 25% of the time, costume 2 : 30 %,costume 3 : 44% and costume 4 is the super shiny appearing 1% of the time.
Then, you'll have in your list : (25 ; 55 ; 99 ; 100).
(55 = 25 + 30; 99 = 25 + 30 + 44 ; 100 = 25 + 30 + 44 + 1)
From there, you just have to pick a random number between 1 and 100 and test which list item is higher than your random number :

- SBissay
-
500+ posts
How do i randomize costumes?
(snip)
I don't think i'm up to that level yet in coding. I'm also not very familiar with lists yet, and how to use them in advanced code. But your help is very appreciated. Thank you.
You're welcome ! Good luck with your project.

- WookieeRoyale
-
9 posts
How do i randomize costumes?
In that case, you probably have to use variables. But I want it to be less common for certain costumes.
I've made a simple script here: https://scratch.mit.edu/projects/142407892/
- asivi
-
1000+ posts
How do i randomize costumes?
Edited
Please share the project.
Please share the project.
Last edited by asivi (Jan. 29, 2017 12:02:05)
- Despicable_Dad
-
500+ posts
How do i randomize costumes?
So I want it to broadcast “Caught Fish” so that it will show a shining ring around the caught fish. And I want it to happen when if the “Fish” variable is below say 700.
Remove the second and third broadcasts? (Am I missing something here?)
- asivi
-
1000+ posts
How do i randomize costumes?
Perhaps the OP is broadcasting “in water” more than one time while waiting the random time it has.So I want it to broadcast “Caught Fish” so that it will show a shining ring around the caught fish. And I want it to happen when if the “Fish” variable is below say 700.
Remove the second and third broadcasts? (Am I missing something here?)
@Toasty_Boy please share your project.
Last edited by asivi (Jan. 29, 2017 12:13:33)
- Blue_Science
-
100+ posts
How do i randomize costumes?
I thins this would be adapted for you :