Random Number From 2 Set Values

Started by eithanz on Sat, 11/02/2019 - 07:36

Topic category: Help with MCreator modding

Last seen on 15:29, 10. Nov 2019
Joined May 2015
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
Random Number From 2 Set Values
Sat, 11/02/2019 - 07:36

hey so i have a code for when you break a block with a certain tool, you get instead of the block a random number of another item, but i cant seem to get a code of

a random number so i can give the player 1-3 of the other item

if someone could help me by sending a code example of how to make a random number from 1-X it would be AMAZING

ty 

0Upvote this forum topic
Last seen on 19:22, 5. Dec 2019
Joined Aug 2019
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
If you want it to drop 1-3…
Sat, 11/02/2019 - 12:10

If you want it to drop 1-3 of the item then you will need to use random[0,1]. Make a local variable and set it to random[0,1], Then make 3 if statements with if the local variable is over a certain amount (0, 0.333, 0.666 should work) then spawn a 'gem' of the specified item for each of them.

0Upvote this forum topic
Last seen on 15:29, 10. Nov 2019
Joined May 2015
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
ty  
Sat, 11/02/2019 - 15:17

ty

 

0Upvote this forum topic
Last seen on 19:22, 5. Dec 2019
Joined Aug 2019
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
You're welcome.
Mon, 11/04/2019 - 08:45

You're welcome.

0Upvote this forum topic
Last seen on 10:34, 4. Dec 2019
Joined Dec 2013
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
I have another method…
Mon, 11/04/2019 - 12:01

I have another method

Imagine _i is the resulting value

set _i to (round up ((random 0,1)*3))

Then check for _i if its 1 or 2 or 3.

0Upvote this forum topic