Solved Gamble script help

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

drillzy

Member
Aug 6, 2017
22
0
0
20
Hello guys, i am trying to make a /gamble script where it will use 1,000 of a balance and it will do a counter from 3 to 1 which i have set up but i have no idea how to give it a chance system that always picks from something from the list. i use chance from skript but it gives me sometimes the items but sometimes it gives me nothing because of the way the chances are. if anyone knows how i can make it pick an item with a percentage to get, please tell me. {gems.balance.%player%} is my balance variable.

CODE:
Code:
        if arg is "start":
            if {gems.balance.%player%} is greater than or equal to 1000:
                subtract 1000 from {gems.balance.%player%}
                set {_counter} to 3
                loop 3 times:
                    send ""
                    send "&a&l&o                         %{_counter}%"
                    send ""
                    wait 1 second
                    subtract 1 from {_counter}
                chance of 50%:
                    add 2000 to {gems.balance.%player%}
                    send ""
                    send "&cYou have received 2000 Gems"
                    send ""
                chance of 50%:
                    add 1500 to {gems.balance.%player%}
 
Here, hope this helps bud!
code_language.skript:
        if arg is "start":
            if {gems.balance.%player%} is greater than or equal to 1000:
                subtract 1000 from {gems.balance.%player%}
                set {_counter} to 3
                loop 3 times:
                    send ""
                    send "&a&l&o                         %{_counter}%"
                    send ""
                    wait 1 second
                    subtract 1 from {_counter}
                set {chance} to a random integer between 1 and 2
                if {chance} is 1:
                    add 2000 to {gems.balance.%player%}
                    send ""
                    send "&cYou have received 2000 Gems"
                    send ""
                if {chance} is 2:
                    add 1500 to {gems.balance.%player%}
 
Correct, if you wanted to add more win situations you'd add to the random integer count, so here's an example. Not a problem :emoji_grinning: !
code_language.skript:
        if arg is "start":
            if {gems.balance.%player%} is greater than or equal to 1000:
                subtract 1000 from {gems.balance.%player%}
                set {_counter} to 3
                loop 3 times:
                    send ""
                    send "&a&l&o                         %{_counter}%"
                    send ""
                    wait 1 second
                    subtract 1 from {_counter}
                set {chance} to a random integer between 1 and 5 # Notice I Changed The End Number To Give The Range More Numbers To Represent More Situations
                if {chance} is 1:                                 # JUST A SIDE NOTE "{chance}" Can Literally Be Named Anything You Want, Not Just "chance" Inside The Brackets
                    add 2000 to {gems.balance.%player%}
                    send ""
                    send "&cYou have received 2000 Gems"
                    send ""
                if {chance} is 2:
                    add 1500 to {gems.balance.%player%}
                    send ""
                    send "&cYou have received 1500 Gems"
                    send ""
                if {chance} is 3:
                    add 1000 to {gems.balance.%player%}
                    send ""
                    send "&cYou have received 1000 Gems"
                    send ""
                if {chance} is 4:
                    add 750 to {gems.balance.%player%}
                    send ""
                    send "&cYou have received 750 Gems"
                    send ""
                if {chance} is 5:
                    subtract 500 from {gems.balance.%player%}
                    send ""
                    send "&cYou have lost 500 Gems"
                    send ""
 
ok, that works too. and if i were to want the chances or rarity of the win to be less or higher then i could just add more of those chance wins of the same to make it more common or make less chance win to make it rare. correct?
 
ok, that works too. and if i were to want the chances or rarity of the win to be less or higher then i could just add more of those chance wins of the same to make it more common or make less chance win to make it rare. correct?
If you mean pretty much to increase a chance of a certain event(s) you wrote, to copy and paste the code under different numbered "if {chance}" 's , then yes :emoji_slight_smile:
[doublepost=1502002228,1502002195][/doublepost]I probably made that sound dumb xD
 
Status
Not open for further replies.