Discuss Scratch

sussus-_moogus
Scratcher
25 posts

how do i make a costume rare

what i mean is https://scratch.mit.edu/projects/607679359/editor/ i need help making unfairness bambi a rare pet
xarparx
Scratcher
100+ posts

how do i make a costume rare

Please share the project, so we can see the problem and find a solution.

This may help:
ifpickrandom1to10000=1thenswitchcostumeto... You can substitute any number for 10,000. This is just for an example.

Last edited by xarparx (Nov. 27, 2021 03:52:06)

Scratch137
Scratcher
1000+ posts

how do i make a costume rare

I assume this is the code you're talking about:


The issue with this is that the “pet” sprite only has four costumes. If you attempt to set the costume to any number higher than 4, it will loop back around to 0 and continue counting from there. This means that 5=1, 6=2, and so on.

Instead, you can try creating a new variable to pick a random number. For example:

whenclickedsetcostumetopickrandom1to10ifcostume=10thenswitchcostumetoUnfairelseswitchcostumetopickrandom1to3
This script gives the “Unfair” costume a 10% chance to appear, while all the other costumes have a 30% chance.

You can play around with different numbers; for example:
setcostumetopickrandom1to100
This gives the “Unfair” costume a 1% chance to appear, while all the other costumes have a 33% chance.

Here's the whole script with this code added:

Last edited by Scratch137 (Nov. 27, 2021 06:00:55)

Powered by DjangoBB