Randomizing

Started by Benoniusthecat on Sat, 09/21/2019 - 02:56

Topic category: Help with MCreator modding

Last seen on 20:13, 17. Oct 2019
Joined Sep 2019
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
Randomizing
Sat, 09/21/2019 - 17:24 (edited)

I was thinking about making a kind of radio receiver thing that when used, will give you a random message with help on the mod, but how could I randomize it? If you have a solution, let me know! (NOTE: I am not wanting this to be a block)

Edited by Benoniusthecat on Sat, 09/21/2019 - 17:24
Last seen on 12:10, 18. Oct 2019
Joined Aug 2019
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
https://www.youtube.com…
Sat, 09/21/2019 - 12:03

https://www.youtube.com/watch?v=SBtTsNYiHzw

If you don't want a 50/50 randomiser but want to have, say 5 messages of which 1 has to appear at random: 1/8 = 0.125.PROCEDURE:


Set random_local_variable to random[0,1]

if random_local_variable < 0.125

do message 1

else if random_local_variable < 0.125 * 2

do message 2

else if random_local_variable < 0.125 * 3

do message 3

else if random_local_variable < 0.125 * 4

do message 4

else

do message 5

 

Last seen on 12:10, 18. Oct 2019
Joined Aug 2019
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
EDIT: the 0.125 was meant…
Sat, 09/21/2019 - 12:04

EDIT: the 0.125 was meant for 8 results. change that number to 1/5 = 0.2

I suggest you check our…
Sat, 09/21/2019 - 13:00

I suggest you check our tutorials collection playlist on our YouTube channel which contains many examples and tutorials that can help you get started with MCreator: https://www.youtube.com/playlist?list=PLAeL-oIFIEngE6jRgFYeFMfuj8WQsO3Ei

Last seen on 20:13, 17. Oct 2019
Joined Sep 2019
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
Thanks! This worked after a…
Sat, 09/21/2019 - 19:16

Thanks! This worked after a few tries and I really like the result!