Skray Posted May 9, 2021 Share Posted May 9, 2021 I need a script that if you break a block it is 1% that you get a chest named backpack. When you right click with it, you will get some random items (stone, diamond, logs, iron, coal) 1 Link to comment Share on other sites More sharing options...
rosathorn Posted May 9, 2021 Share Posted May 9, 2021 For this it is simple, and I don't want to spoon feed so I can't just give that to you. But to do this, just set up an on break event, use "chance of 1%:", give the player an item named backpack then do an on right click event, if the held item's name is backpack then remove 1 of that item and give the player some things again. Be sure to indent your code as well. 1 RosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRi code, animate, develop, UI design, learn, and adapt, as well as make servers, of courseJoined Minehut sometime in 2014VIP sometime in 2018Legend in January 2021Helper on 4/11/2021♥ (Retired) on 5/17/2021 Link to comment Share on other sites More sharing options...
Skray Posted May 10, 2021 Author Share Posted May 10, 2021 Thanks! But how to like on right click, 10% to get stone, 10% coal... Link to comment Share on other sites More sharing options...
CoolProgrammer Posted May 10, 2021 Share Posted May 10, 2021 30 minutes ago, Skray said: Thanks! But how to like on right click, 10% to get stone, 10% coal... Example: on block break: chance of 10%: # do stuff 1 Hello there! If you're reading this, hope you're having a wonderful day! Feel free to contact me via Discord (CoolProgrammer#1920) for any help. My DMs are always open for help. You can also message via. forum messages for help. Also, don't hesitate to leave a like on my post if I helped you in any way. Link to comment Share on other sites More sharing options...
Skray Posted May 10, 2021 Author Share Posted May 10, 2021 2 hours ago, CoolProgrammer said: Example: on block break: chance of 10%: # do stuff So would this work? on block break: chance of 1%: give player chest named "&4Backpack" on right click with chest named "&4Backpack" chance of 25%: give player 64 stone chance of 50%: give player 16 beef chance of 50%: give player 5 diamond Link to comment Share on other sites More sharing options...
bartdepro Posted May 10, 2021 Share Posted May 10, 2021 yes but u prob know that already gl Link to comment Share on other sites More sharing options...
Skray Posted May 10, 2021 Author Share Posted May 10, 2021 46 minutes ago, bartdepro said: yes but u prob know that already gl no, I am not a skripter Link to comment Share on other sites More sharing options...
Skray Posted May 10, 2021 Author Share Posted May 10, 2021 5 hours ago, CoolProgrammer said: Example: on block break: chance of 10%: # do stuff How do I stop multiple chances of happening? Like stop this for multiples: right click: chance of 50%: give player 64 stone chance of 50%: give player 16 beef chance of 50%: give player 5 diamond Link to comment Share on other sites More sharing options...
CoolProgrammer Posted May 10, 2021 Share Posted May 10, 2021 49 minutes ago, Skray said: How do I stop multiple chances of happening? Like stop this for multiples: right click: chance of 50%: give player 64 stone chance of 50%: give player 16 beef chance of 50%: give player 5 diamond Oh, in that case you can use the stop keyword. right click: chance of 50%: give player 64 stone stop chance of 50%: give player 16 beef stop chance of 50%: give player 5 diamond stop This prevents the code moving further. Also note that your code would probably not work as per your expectations. You will only have a 50% chance of getting 16 beef if you didn't get 64 stone. And you will only get 5 diamonds if you didn't get 64 stone and 16 beef. Sorry if you didn't understand what I said, especially with by crap English, but here is a better way of doing this: right click: give player 64 stone, 16 beef or 4 diamond This will give the player, random item from the ones listed. Notice the "or". Hello there! If you're reading this, hope you're having a wonderful day! Feel free to contact me via Discord (CoolProgrammer#1920) for any help. My DMs are always open for help. You can also message via. forum messages for help. Also, don't hesitate to leave a like on my post if I helped you in any way. Link to comment Share on other sites More sharing options...
Skray Posted May 10, 2021 Author Share Posted May 10, 2021 1 minute ago, CoolProgrammer said: Oh, in that case you can use the stop keyword. right click: chance of 50%: give player 64 stone stop chance of 50%: give player 16 beef stop chance of 50%: give player 5 diamond stop This prevents the code moving further. Also note that your code would probably not work as per your expectations. You will only have a 50% chance of getting 16 beef if you didn't get 64 stone. And you will only get 5 diamonds if you didn't get 64 stone and 16 beef. Sorry if you didn't understand what I said, especially with by crap English, but here is a better way of doing this: right click: give player 64 stone, 16 beef or 4 diamond This will give the player, random item from the ones listed. Notice the "or". Thank you! Can I like make so it is 50% getting something, 25% getting something else, 15% getting something else and 10% to something else. Without using using the multiply chances? Link to comment Share on other sites More sharing options...
Noly Posted May 10, 2021 Share Posted May 10, 2021 Quote Thank you! Can I like make so it is 50% getting something, 25% getting something else, 15% getting something else and 10% to something else. Without using using the multiply chances? To do that id recommend making the skript pick a random number and going off that... i know its ineffecient but its the best idea i have. command /luck: trigger: set {_number} to %random integer between 1 and 100% if {_number} is 1-20: #do stuff stop if {_number} is 21-60: #do other stuff stop else: #do even more stuff stop 1 Link to comment Share on other sites More sharing options...
Skray Posted May 10, 2021 Author Share Posted May 10, 2021 1 hour ago, Noly said: To do that id recommend making the skript pick a random number and going off that... i know its ineffecient but its the best idea i have. command /luck: trigger: set {_number} to %random integer between 1 and 100% if {_number} is 1-20: #do stuff stop if {_number} is 21-60: #do other stuff stop else: #do even more stuff stop Thank you! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now