[SOLVED] LootBag Help

Started by Sagicraft on

Topic category: Help with modding (Java Edition)

Last seen on 07:59, 28. Jul 2022
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
[SOLVED] LootBag Help
Tue, 05/03/2022 - 23:57 (edited)

hello! i need some help with my lootbags. Right now it works BUT it gives me more than one item at a time. How to I make it so it only gives me ONE random item instead of 1-3 random item each time.

( all the items and black orb are placeholders)

the code

Edited by Sagicraft on Tue, 05/03/2022 - 23:57
Last seen on 05:05, 30. Oct 2022
Joined Mar 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Set in your Random number…
Tue, 05/03/2022 - 00:34

Set in your Random number into a local number variable (vNum).  

 

If vNum < 0.10 do ~

Else If vNum < 0.15 do ~

Else If vNum < 0.24 do ~

Else If vNum < 0.34 do ~

Last seen on 07:59, 28. Jul 2022
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
i dont quite understand…
Tue, 05/03/2022 - 01:10

i dont quite understand. what should i replace ?

Last seen on 20:09, 15. Aug 2022
Joined Nov 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
he means to set the random…
Tue, 05/03/2022 - 03:28

he means to set the random value to a local variable and from there compare the probabilities

Last seen on 05:05, 30. Oct 2022
Joined Mar 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You want to use a single …
Tue, 05/03/2022 - 06:02

You want to use a single [Random] to choose which item is selected.  Using a local variable "locks in" the roll so you can use the same value for all your comparisons.  If you don't do that, each time you do a check, a different random number would be generated.

Last seen on 06:22, 13. Mar 2023
Joined Feb 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Alternatively, you can use a…
Tue, 05/03/2022 - 07:40

Alternatively, you can use a loot table instead and execute the /summon loot command. It would allow easier alteration of the loot bag for use with other mods.

Last seen on 06:05, 28. Mar 2024
Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Use IF / ELSE not only IF /…
Tue, 05/03/2022 - 13:49

Use IF / ELSE not only IF / DO and you're done