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

Started by Super_m on Sun, 09/16/2018 - 22:56

Topic category: Advanced modding

Last seen on 04:25, 23. Dec 2019
Joined Aug 2015
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Help with code for random number of items dropped from a block
Sun, 09/16/2018 - 22:56

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 22:00, 27. Sep 2020
Joined Apr 2014
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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 04:25, 23. Dec 2019
Joined Aug 2015
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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 22:00, 27. Sep 2020
Joined Apr 2014
User points:

User statistics:

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

Use Spawn Gem

Last seen on 04:25, 23. Dec 2019
Joined Aug 2015
User points:

User statistics:

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

that for some reason works twice

Last seen on 18:24, 24. Sep 2018
Joined Sep 2018
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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 00:41, 29. Jul 2020
Joined Oct 2015
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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!