Random Generator generates a different number client side than server side.

Started by Matt The Banana on

Topic category: Help with modding (Java Edition)

Last seen on 00:53, 14. Mar 2024
Joined Sep 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Random Generator generates a different number client side than server side.

I have some code and when it runs, it gives a number for client side and for server side and they're different.

Here's my code:

https://imgur.com/a/BWwGpBQ

I want to make it so that it only makes a number that is the same client side and server side.

Last seen on 03:10, 19. Feb 2022
Joined Jun 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
If(NOT is world remote){ /…
Tue, 04/28/2020 - 03:55

If(NOT is world remote){

//your number stuff

}

Last seen on 00:53, 14. Mar 2024
Joined Sep 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
But how do I do that in the…
Tue, 04/28/2020 - 12:09

But how do I do that in the procedure creator?

Last seen on 03:10, 19. Feb 2022
Joined Jun 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
there is a is world remote…
Tue, 04/28/2020 - 12:57

there is a is world remote procedure block in the world section iirc

Last seen on 03:10, 19. Feb 2022
Joined Jun 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
If NOT is world remote, not …
Wed, 04/29/2020 - 00:43

If NOT is world remote, not 
If is world remote

Last seen on 00:53, 14. Mar 2024
Joined Sep 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
If not doesn't work either
Wed, 04/29/2020 - 00:48

If not doesn't work either

Last seen on 03:10, 19. Feb 2022
Joined Jun 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Random chance procedures If…
Wed, 04/29/2020 - 07:52

Random chance procedures

If not marked with client or server icon next to the trigger, the procedure triggers trigger procedure on both server and client-side. This is generally not a problem as the procedure will do the same action on both sides. But some procedures use random chance when executing and these procedures can cause different outcomes when they run on both server and client-side.  Examples of such procedures are:

  • Explosions
  • Any procedure involving a random number procedure block
  • Any other procedure that causes strange glitches in the game

For such procedures to work, you need to wrap your procedure with if statement that checks if the current world is server-side:

if NOT "Is provided world remote (client-side)"

    (your existing procedure)

You can find "Is provided world remote (client-side)" procedure block in the "World data" procedure blocks section.

Last seen on 00:53, 14. Mar 2024
Joined Sep 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I managed to fix the problem…
Thu, 04/30/2020 - 17:01

I managed to fix the problem. Thank you. I think the x10 was part of the problem too so I removed it and changed some numbers around and it seems to be working.