Help With Water RNG! (yes, block code is being used in this)

I have decided to make a new game, so I went into a trigger and successfully made an RNG!!! …only to find out that it’s NOT a “random” number generator, and will always give me 20 water. Any clue how to fix this?

Screenshots

Vending machine settings (where you go to get the random water)


Trigger settings (where the RNG will be)

Block code for the RNG

Each channel gives you 10x the amount of water (for example, all Channel 1 gives you 10 water, channel 2 gives you 20, so on and so forth all the way until channel 10)

Thank you highly sophisticated forumers who know what they’re doing :slight_smile: (if you couldn’t tell I don’t because I’ve never made one of these before…)

In your block code, you are checking 1 = 1, which will always return true. To fix this problem, you can make a variable x and set it to random integer from [1] to [10] and then broadcast on

Broadcast Message on Channel: Create text with: "Water"
                                              : x
1 Like

To be even simpler, you can use concatenation and just use this:

Broadcast Message on Channel: Create text with: "Water"
                                              : Random integer from [1] to [10]

But either system works.

Also concatenation for the curious: The Art of Concatenation: Credits to @Zypheir and @Blackhole927- Difficulty 7.5/10 or 🟧

I also might be making a series on learning and mastering block code (: we’ll see.

1 Like

Like this?

2 Likes

Wait actually, why aren’t you just making your code in an item granter? Like so:

Grant player custom amount of item: (random number [1] to [10] * [10])

And then the item the item granter gifts you water?

But yes that code you have should also work.

1 Like

WAIT YOU CAN DO THAT?!?!

Huh you can lol

Honestly, that’s probably a better way to do things than having the trigger do it… and then this way I won’t have an army of ten item granters across my screen when I’m trying to decorate…

2 Likes


Block code like so?
(sorry I’ve NEVER DONE THIS TYPE OF THING BEFORE :sweat_smile: :grin: )

Here you’re getting an integer from 1 x 10 = 10 to 10 x 10 = 100, not from 1 to 10
Try this instead:

... (random integer from [1] to [10]) x 10
2 Likes


Like this??

2 Likes

Yes, exactly like that!

2 Likes

YAY! TYSM everyone it works!

I’m gonna credit u guys don’t worry :slight_smile:

2 Likes

This topic was automatically closed 3 hours after the last reply. New replies are no longer allowed.