Discuss Scratch

Upauggfg12343nk
Scratcher
100+ posts

How do I make RNG?

so when I click the button, it will show roll a random item, they all have their own rarity: 1 in 2, 1 in 4, 1 in 100k, 1 in 1m, etc.

and I'm confused on how to script it, can someone help me?




xavidoodleALT
Scratcher
2 posts

How do I make RNG?

So like a poker machine roll type thing?


Upauggfg12343nk
Scratcher
100+ posts

How do I make RNG?

xavidoodleALT wrote:

So like a poker machine roll type thing?


pretty much, no. You only can roll 1 at a time and it all depends on ur luck and what you'll get.

It's pretty much like sol's rng in roblox

Last edited by Upauggfg12343nk (March 23, 2024 05:27:58)





MakeGamsse
Scratcher
4 posts

How do I make RNG?

Upauggfg12343nk wrote:

xavidoodleALT wrote:

So like a poker machine roll type thing?


pretty much, no. You only can roll 1 at a time and it all depends on ur luck and what you'll get.

It's pretty much like sol's rng in roblox
you can do PICK RANDOM 1 to (however many) and if its = 1 then make it do
but if its anything else then do pic krandom from however many for another roll e.g.
if its not that u can make more so yea
Eason_9
Scratcher
1000+ posts

How do I make RNG?

You can do it with the pick random block:

<(pick random (1) to (10)) = (1) > // This will return "true" 1 in 10 times.
<(pick random (1) to ((100) / (10))) = (1)> // This will return "true" 10% of the times.

Basically, the code picks a random number and it will detect if its equal to one, which creates a system to detect rarity of things. So, for example:

if <(pick random (1) to (10)) = (1) > then
go to [ mouse pointer v]
end

The code above will let the sprite go to the mouse pointer 1 in 10 times.

*This is my signature, more info on it here! Scroll down by highlighting anywhere and press shift and the down arrow key.

Get your images up to the forums with my shop: Imagif Hosters (for free!)
If you have some time to spare, perhaps go read my Scratch Wiki essays!
And since I'm here I should probably advertise my projects but I can't find a good project I made.
11 (almost 12) - He/Him

Powered by DjangoBB