Help with code for random number of items dropped from a block

Started by Super_m on

Topic category: Advanced modding

Last seen on 00:23, 19. Dec 2023
Joined Aug 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Help with code for random number of items dropped from a block

I need code for random amount of items dropped from block when it's broken. I tried creating a procedure for that, but after many failed attempts I gave up.

I know there are quite a few forum topics answearing this question, but I think they are all outdated.

If anyone could give me tips or point me out to up-to-date guide I would very much appricate it.

Last seen on 03:03, 6. Feb 2024
Joined Apr 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Try to use Repeat function…
Mon, 09/17/2018 - 15:14

Try to use Repeat function and put inside it Repeat Random 0,1 times
if not than make local variable that will be set to random and place in repeat function block that will take number from this variable

 

Last seen on 00:23, 19. Dec 2023
Joined Aug 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
cool idea, only problem is…
Mon, 09/17/2018 - 15:21

cool idea, only problem is there is no way for me to give item to the player. Maybe there's a way I overlooked?

Last seen on 03:03, 6. Feb 2024
Joined Apr 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Use Spawn Gem
Mon, 09/17/2018 - 16:43

Use Spawn Gem

Last seen on 00:23, 19. Dec 2023
Joined Aug 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
that for some reason works…
Mon, 09/17/2018 - 20:48

that for some reason works twice

Last seen on 17:01, 3. Jun 2022
Joined Sep 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Probably make it so that the…
Wed, 09/19/2018 - 05:04

Probably make it so that the block itself doesn't break into anything (or breaks into air) in the block properties if you're also going to use the Spawn Gem event.

Last seen on 12:58, 23. Sep 2019
Joined Aug 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You have to override…
Sun, 10/14/2018 - 15:21

You have to override quantityDropped, set you max and min amount of drops and use the rand function

Last seen on 06:31, 18. Nov 2022
Joined Oct 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
My type of code (the way my…
Tue, 11/20/2018 - 21:52

My type of code (the way my mod's code was before the rewriting) somehow just spammed the player's inventory with diamonds for no reason, well unless the reason is moving a few blocks at all, that might be it, because that's exactly what it seems like to me in-game!