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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved Chance of

Discussion in 'Skript' started by Crocie, Sep 3, 2021.

Thread Status:
Not open for further replies.
  1. Crocie

    Crocie Member

    Joined:
    Jul 2, 2021
    Messages:
    27
    Likes Received:
    0
    Please help me, this line dosen't work,

    Code (Text):
    1. chance of {key.chance.%player%}%:
    Full code

    Code (Text):
    1. command /pickset <text> <integer>:
    2.     trigger:
    3.         if arg 1 = "key":
    4.             set {key.random.%player%} to arg 2
    5.  
    6. on break:
    7.     if event-block is stone:
    8.         if player is holding a diamond pickaxe:
    9.             set {key.chance.%player%} to {key.random.%player%}
    10.             send "%{key.chance.%player%}%"
    11.             chance of {key.chance.%player%}%:
    12.                 set {item} to coal
    13.             subtract 1 from {key.chance.%player%}
    14.             chance of {key.chance.%player%}%:
    15.                 set {item} to iron ingot
    16.             subtract 1 from {key.chance.%player%}
    17.             chance of {key.chance.%player%}%:
    18.                 set {item} to gold
    19.             subtract 1 from {key.chance.%player%}
    20.             chance of {key.chance.%player%}%:
    21.                 set {item} to diamond
    22.             subtract 1 from {key.chance.%player%}
    23.             chance of {key.chance.%player%}%:
    24.                 set {item} to netherite ingot
    25.             give {item} to player


     
    #1 Crocie, Sep 3, 2021
    Last edited: Sep 3, 2021
  2. Best Answer:
    Post #7 by barrybtw, Sep 5, 2021
  3. ShyDoge

    ShyDoge Member

    Joined:
    Jul 31, 2021
    Messages:
    41
    Likes Received:
    1
    I'm confused, what is {key.chance.%player%}
     
  4. Minecoll_YT

    Supporter Forums Helper

    Joined:
    Dec 2, 2018
    Messages:
    597
    Likes Received:
    37
    List and local variables be like: :emoji_angry:
     
  5. Crocie

    Crocie Member

    Joined:
    Jul 2, 2021
    Messages:
    27
    Likes Received:
    0
    I don't get it, but all i need is a way to do "chance of {integer.variable}%:"
     
  6. TheCubPlays

    TheCubPlays Member

    Joined:
    Jun 22, 2021
    Messages:
    35
    Likes Received:
    3
    I suggest using {key::chance::%player's uuid%} instead of {key.chance.%player%}, basicly not using dots but colons in general for variables..try that but what error do you get..? Also in this case you wanna use player's uuid not player. You should try to do a research on that and figure out when you should use player's uuid and when player. It's important sometimes.
     
  7. Crocie

    Crocie Member

    Joined:
    Jul 2, 2021
    Messages:
    27
    Likes Received:
    0
    Thx, but still dosen't solve my problem.
     
  8. barrybtw

    barrybtw Active Member

    Joined:
    Jun 8, 2021
    Messages:
    82
    Likes Received:
    6
    Code (Text):
    1. chance of {key::chance::%player's uuid%}:
    The % is optional.
     
  9. Crocie

    Crocie Member

    Joined:
    Jul 2, 2021
    Messages:
    27
    Likes Received:
    0
    if i don't have % before : it's 100% so chance of becomes kinda useless
     
  10. ShyDoge

    ShyDoge Member

    Joined:
    Jul 31, 2021
    Messages:
    41
    Likes Received:
    1
    I suggest lightening your code by packaging all the variables into one variable BEFORE you set the chance

    Code (Text):
    1. set {Variable} to {key::chance::%player's UUID%}
    2. chance of {Variable}%:
    3.   broadcast "Pink and Purple dinosaurs"
     
  11. barrybtw

    barrybtw Active Member

    Joined:
    Jun 8, 2021
    Messages:
    82
    Likes Received:
    6
    'Lightening your code' hilarious. Seems you don't know what you're doing...
     
  12. Minecoll_YT

    Supporter Forums Helper

    Joined:
    Dec 2, 2018
    Messages:
    597
    Likes Received:
    37
    What the... the heck is this? And even if you would do this... USE A LOCAL VARIABLE
     
  13. Crocie

    Crocie Member

    Joined:
    Jul 2, 2021
    Messages:
    27
    Likes Received:
    0
    Code (Text):
    1. subtract 1 from {key.chance.%player%}
    after this it stoped working
     
Thread Status:
Not open for further replies.

Share This Page

Loading...