Same chances for everething

Started by a guy called l… on

Topic category: Help with modding (Java Edition)

Last seen on 23:35, 30. Oct 2023
Joined Jan 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Same chances for everething

I Wanna to do a mod that add pills based no the binding of Isaac pills, the effects are Easy, i only need to use /atributte, but I have a problem whit a thing: Pills will be Random per world (the orange pill can give you Healt up in a world, but in other, can be Speed down) and I dont now how to do a random chance base to set what effect gives orange pill, i now about Random 0.1, but i Wanna that the chance be fair, if I use:

If Random 0,1 ≥ 0,5 do

Set text variable "orange pill effect" to "Healt up"

If not

Set text variable "orange pill effect" to Healt down

 

The problem is: that procedure only work for two effects, but i Wanna to add More effects, somenone can help me? Please

I have no problem whit evade that a pill gives the same effect of another pill.

I try the next procedure:

Set "variable" to Random 0,1

If "variable" ≥ 0,49 do

Set "orange pill effect" to "Healt down"

If "variable" ≤ 0,5 do

Set "orange pill effect" to Healt up

It dont work, i do it bad or what happened?

Please help ;_;

Last seen on 05:04, 24. Apr 2024
Joined Apr 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Instead of only having two…
Mon, 09/06/2021 - 04:56

Instead of only having two ranges (0-0.49 and 0.51-1), you can set a variable to a random number 0-1, then have multiple if statements to determine which value you want to use. Example: Your random variable is set to 0-1. You have one if statement checking for that variable being 0-0.2, another to check for 0.21-0.4, another for 0.41-0.5, etc. Each one of these ranges will be your output (which effect the pill will grant). You just need to make sure that you divide the 0-1 range equally depending on how many effects you want to be possible for the pill.

Last seen on 23:35, 30. Oct 2023
Joined Jan 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thanks, it work :D
Tue, 09/07/2021 - 00:27

Thanks, it work :D