Discuss Scratch

ScratchSupremer
Scratcher
6 posts

I'm making an rng game (like sol's rng on roblox) and my rng is very innefficient.

I need to find a way to find a way to make the rng just more efficient. The way i use right now is
when green flag clicked
repeat (2)
add [rare] to [chance]
end
repeat (4)
add [common] to [chance]
end
Etc, etc.
But, since there's so many rarities and a cap of 400000 items on lists, it just is too inefficient.

forever
set pen color to (imagination)
end
-TUB-
Scratcher
100+ posts

I'm making an rng game (like sol's rng on roblox) and my rng is very innefficient.

You can do this:
set [rand v] to (pick random (0.0) to (1.0))
if <(rand) < (legendaryChance)> then
set [result v] to [legendary]
else
if <(rand) < (epicChance)> then
set [result v] to [epic]
else
if <(rand) < (rareChance)> then
set [result v] to [rare]
else
set [result v] to [common]
end
end
end

- T U B -
The United Bathtubs


Select part of my signature and use shift+down arrow to see the rest





ScratchSupremer
Scratcher
6 posts

I'm making an rng game (like sol's rng on roblox) and my rng is very innefficient.

-TUB- wrote:

You can do this:
set [rand v] to (pick random (0.0) to (1.0))
if <(rand) < (legendaryChance)> then
set [result v] to [legendary]
else
if <(rand) < (epicChance)> then
set [result v] to [epic]
else
if <(rand) < (rareChance)> then
set [result v] to [rare]
else
set [result v] to [common]
end
end
end
Okay! I'll try this.

forever
set pen color to (imagination)
end
ScratchSupremer
Scratcher
6 posts

I'm making an rng game (like sol's rng on roblox) and my rng is very innefficient.

ScratchSupremer wrote:

-TUB- wrote:

You can do this:
set [rand v] to (pick random (0.0) to (1.0))
if <(rand) < (legendaryChance)> then
set [result v] to [legendary]
else
if <(rand) < (epicChance)> then
set [result v] to [epic]
else
if <(rand) < (rareChance)> then
set [result v] to [rare]
else
set [result v] to [common]
end
end
end
Okay! I'll try this.
It works but the numbers are really rigged.

forever
set pen color to (imagination)
end

Powered by DjangoBB