Chest refill

  • 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.

SoMuchWessel

Active Member
Apr 3, 2017
147
3
18
47
Hi guys,

I ran into a little problem with my code.


code_language.skript:
                else if arg-1 is "begin":
                    chance of 90%:
                        clear targeted block's inventory
                        set {_begin} to random element out of {basic.food::*}
                        add {_begin} to targeted block's inventory
                        chance of 90%:
                            set {_begin} to random element out of {basic.food::*} # chance of getting a second basic food item
                            add {_begin} to targeted block's inventory
                        chance of 40%:
                            set {_begin} to random element out of {normal.food::*} #Chance of getting a third basic food item
                            add {_begin} to targeted block's inventory
                            chance of 40%:
                                set {_begin} to random element out of {normal.food::*} # Chance of getting a second normal food item
                                add {_begin} to targeted block's inventory
                        chance of 10%:
                            set {_begin} to random element out of {epic.food::*}
                            add {_begin} to targeted block's inventory

What i want is that there is a chance that you get food, and if the chance decides to give you food, that there is 90% chance that it is a basic food, 40% that it is a normal food and 10% chance that it is a epic food.

How do i write this?
 
How do you expect that math to work out? A 90% chance, a 40% chance, and a 10% chance? Those add up to 140%, there's no way to do that as if you've worded it.
 
Status
Not open for further replies.