Chance of NUMBER%: Always chose only 1

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

LoneElf

Active Member
Apr 30, 2017
165
2
18
24
So, this can apply for an auto broadcaster, which is why I am relating to it, so what I need is that every 5 minutes, chance of 50%: broadcast "Hello!", or a chance of 50%: broadcats "Bye!". So, the thing is, in those examples, it will 50% broadcast just Hello, 50% broadcast just Bye, or 50% broadcast both. How would I make it so it broadcasts only 1 of them, chosen by a chance of 50%? Thanks :emoji_slight_smile:
 
with "chance of" it's rolling both chances, therefore there's a chance both or none can be played. A better way to do it would be like
code_language.skript:
set {_chance} to a random integer between 1 and 100
if {_chance} is between 1 and 50:
    broadcast "hello"
if {_chance} is between 51 and 100:
    broadcast "bye"
 
  • Like
Reactions: L0v0lup
So, this can apply for an auto broadcaster, which is why I am relating to it, so what I need is that every 5 minutes, chance of 50%: broadcast "Hello!", or a chance of 50%: broadcats "Bye!". So, the thing is, in those examples, it will 50% broadcast just Hello, 50% broadcast just Bye, or 50% broadcast both. How would I make it so it broadcasts only 1 of them, chosen by a chance of 50%? Thanks :emoji_slight_smile:
3 outcomes can't each have a chance of 50%... do you mean 33% chance for each?

I personally like doing it the way Wynnevir showed because if you use multiple chance of % expressions in a row then the chances in the expressions after the first one get screwed up since you have to consider the probability that the previous chance expressions aren't successful
 
  • Like
Reactions: Wynnevir
Status
Not open for further replies.