[SOLVED] LootBag Help

Started by Sagicraft on

Topic category: Help with Minecraft modding (Java Edition)

Active 3 years ago
Joined May 2022
Points:
439

User statistics:

  • Modifications: 0
  • Forum topics: 2
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 1
[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
Active 2 years ago
Joined Mar 2022
Points:
502

User statistics:

  • Modifications: 0
  • Forum topics: 4
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 65
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 ~

Active 3 years ago
Joined May 2022
Points:
439

User statistics:

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

i dont quite understand. what should i replace ?

Active 3 years ago
Joined Nov 2021
Points:
538

User statistics:

  • Modifications: 0
  • Forum topics: 6
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 9
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

Active 2 years ago
Joined Mar 2022
Points:
502

User statistics:

  • Modifications: 0
  • Forum topics: 4
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 65
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.

Active 2 years ago
Joined Feb 2022
Points:
621

User statistics:

  • Modifications: 1
  • Forum topics: 13
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 161
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.

Active 5 months ago
Joined Mar 2021
Points:
1014

User statistics:

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

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