[SOLVED] LootBag Help

Started by Sagicraft on Tue, 05/03/2022 - 00:03

Topic category: Help with modding (Java Edition)

Last seen on 04:40, 21. Jun 2022
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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 11:26, 7. Jul 2022
Joined Mar 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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 04:40, 21. Jun 2022
Joined May 2022
Points:

User statistics:

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

i dont quite understand. what should i replace ?

Last seen on 03:36, 24. May 2022
Joined Nov 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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 11:26, 7. Jul 2022
Joined Mar 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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 01:37, 29. Jun 2022
Joined Feb 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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 08:44, 7. Jul 2022
Joined Mar 2021
Points:

User statistics:

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