Help with Random Procedure

Started by Jindō on

Topic category: Help with Minecraft modding (Java Edition)

Joined May 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Help with Random Procedure

Hey Everyone,

I'm working to make a Naruto RPG Mod for Minecraft and am very excited to learn how to use the MCreator interface. Upon a player loading into a new world, they will be greeted with a GUI that will have a button to generate their clan. I attempted to make a Procedure connected to the button that when pressed displays a randomly generated clan but I think my logic is a little off. There are 50 or so clans in Naruto so the probability of generating one for the player should be around ~2% or 0.02.

 

Here is an example of my Procedure: 

if Random[0,1]<= 0.02

do Set Global: clan_Name to : "Aburame"

else if Random[0,1]<= 0.04

do Set Global: clan_Name to : "Akimichi"

...

if Random[0,1]<= 0.98

do Set Global: clan_Name to: "Yuki"

Upon pressing the button for clan generation I get "Yuki" returned which I understand since all values would be less than or equal to 0.98 so the question is how can I create this Procedure to have distinct random occurences so that each clan name has an equal chance of being generated. Thank you for your help!

 

Joined Jan 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Just don't use ".. is…
Sun, 06/27/2021 - 22:20

Just don't use ".. is smaller than..." alone. Do something like >=0.02 and <=0.03 etc. It might take some time, tho.

Joined May 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
@ModProgramMiked I…
Tue, 06/29/2021 - 06:24

@ModProgramMiked

I appreciate the reply and your time, but after testing that method it still didn't end up working. I was able to adjust the logic flow and get a working random procedure with the help of this video: https://www.youtube.com/watch?v=GE0kHWQLy4c&ab_channel=McreatorTutorials

I'll leave it linked here so if anyone else stumbles on this post they'll see it too!

Joined Sep 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
bro, what a legend for…
Tue, 09/06/2022 - 11:22

bro, what a legend for putting a yt vid