Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Pick Random 1 to 10
- Themanhimself115
-
4 posts
Pick Random 1 to 10
I may be dumb about this question, but I can't seem to understand the pick random script. I've done some games using it, but can't seem to do the show and hide technique? I've tried ways to add “forever” or not. For people that are willing to help me, I'm using the top code as “When I receive.”
Thank you, Themanhimself115
Thank you, Themanhimself115
- scratch___user12345
-
1000+ posts
Pick Random 1 to 10
Are you saying you want it to be a 50/50 chance if it hides/shows? if so use this:
- xxthepowerful
-
44 posts
Pick Random 1 to 10
For example :
You can use the pick random block If for example you want something to hide and then wait a random time between for 1-10 sec and then show.
You can use the pick random block If for example you want something to hide and then wait a random time between for 1-10 sec and then show.
- Themanhimself115
-
4 posts
Pick Random 1 to 10
My idea was mostly to make the enemy spawn at one of the four points on the map. Basically, I want it if this random doesn't do the right number, then it would try this random number, but if that number wasn't chosen, then it… etc.
link: https://scratch.mit.edu/projects/681037483/
Just go to the link and go to the enemy sprite and i guess try?
Thanks.
link: https://scratch.mit.edu/projects/681037483/
Just go to the link and go to the enemy sprite and i guess try?
Thanks.
Last edited by Themanhimself115 (May 9, 2022 16:35:37)
- deck26
-
1000+ posts
Pick Random 1 to 10
I suspect you're making the common mistake
What you should have is
The second one only generates one random number which will have a value 1 to 4. The first generates multiple random numbers and hopes it eventually gets a match with no guarantee it will.
What you should have is
The second one only generates one random number which will have a value 1 to 4. The first generates multiple random numbers and hopes it eventually gets a match with no guarantee it will.
Last edited by deck26 (May 9, 2022 17:32:33)
- KaaBEL-NOOB
-
64 posts
Pick Random 1 to 10
Do you mean choosing one of few starting positions by random index? I would recommend having list with the position values in pairs:
item 1 = x position of first spawnpoint
item 2 = y position of first spawnpoint
3 = x pos. of second
4 = y pos. of second
5 = x…
6 = y etc.
Then pick random block can even use lenght of list so you can easily add or remove new spawn positions. The position choosing script will look like this.
item 1 = x position of first spawnpoint
item 2 = y position of first spawnpoint
3 = x pos. of second
4 = y pos. of second
5 = x…
6 = y etc.
Then pick random block can even use lenght of list so you can easily add or remove new spawn positions. The position choosing script will look like this.
- tb361
-
1 post
Pick Random 1 to 10
can someone help me i need when this sprite clicked do random 1 to 10 how do i do it
- The_Imaginarium
-
1000+ posts
Pick Random 1 to 10
Please create a new topic instead of posting on an existing one if you need help. But to answer your question, have a “when sprite clicked” event block set a variable to random 1 to 10 and change whatever you need according to that variable. For example, can someone help me i need when this sprite clicked do random 1 to 10 how do i do it
- 12435tryhgefbkudrhhc
-
25 posts
Pick Random 1 to 10
How can i use this block, It is very confusing
- gsaa_711
-
1 post
Pick Random 1 to 10
after that just arrange the blocks correctly
Last edited by gsaa_711 (April 21, 2024 08:20:09)
- _-Wolf-Spirit-_
-
2 posts
Pick Random 1 to 10
I'm trying to do something where you use a list and you can put thing on the list when playing, and I need to figure out how to make it choose random 1 to the top number that is on the list.
- MrKingofScratch
-
100+ posts
Pick Random 1 to 10
I'm trying to do something where you use a list and you can put thing on the list when playing, and I need to figure out how to make it choose random 1 to the top number that is on the list.
The length of list block outputs how long the list is, or as you put it “the top number that is on the list.”
- bloxyandbrew
-
45 posts
Pick Random 1 to 10
what this guy means is that the first one makes the deeper the ifs are, the rarer the chance, the second one always has an even chance for all of them. I suspect you're making the common mistake
What you should have is
The second one only generates one random number which will have a value 1 to 4. The first generates multiple random numbers and hopes it eventually gets a match with no guarantee it will.
- Discussion Forums
- » Help with Scripts
-
» Pick Random 1 to 10