Jump to content

Need help with script


Skray

Recommended Posts

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.

  • Like 1

rose city STICKER

RosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaRosaR

i code, animate, develop, UI design, learn, and adapt, as well as make servers, of course

💐Joined Minehut sometime in 2014
💐VIP sometime in 2018
💐Legend in January 2021
💐Helper on 4/11/2021
💐♥ (Retired) on 5/17/2021
💐 Moderator on 8/18/2023

Link to comment
Share on other sites

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

 

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

1604908226_ScreenShot2021-01-28at10_32_28AM.png.2646ad6be239a9d0756a99e8e15602ab.png

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

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

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

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.

1604908226_ScreenShot2021-01-28at10_32_28AM.png.2646ad6be239a9d0756a99e8e15602ab.png

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

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

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

 

  • Thanks 1
Link to comment
Share on other sites

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...