Guaranteed drop with chance

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

CringeBoy

Active Member
May 20, 2021
65
0
6
Romania
Code:
on right click:
  if event-block is ender portal frame:
    open virtual chest inventory with size 1 named "Crate" to player
    chance of 14%:
      add 2 gray dye to {_ccrate::*}
    chance of 14%:
      add 1 cactus green to {_ccrate::*}
    chance of 14%:
      add 3 rose red to {_ccrate::*}
    chance of 14%:
      add 3 magenta dye to {_ccrate::*}
    chance of 14%:
      add 1 orange dye to {_ccrate::*}
    chance of 14%:
      add 1 cocoa bean to {_ccrate::*}
    chance of 4%:
      add golden chestplate named "&fHazmat Suit" to {_ccrate::*}
    chance of 1%:
      add 1 chainmail helmet to {_ccrate::*}
    chance of 1%:
      add 1 chainmail helmet of knockback 7 with all flags hidden to {_ccrate::*}
    chance of 1%:
      add 1 ladder item named "&fWooden Ladder" to {_ccrate::*}
    chance of 1%:
      add chainmail chestplate to {_ccrate::*}
    chance of 1%:
      add chainmail leggings to {_ccrate::*}
    chance of 1%:
      add iron axe to {_ccrate::*}
    chance of 1%:
      add wood button named "&fSatchel Charge" to {_ccrate::*}
    loop {_ccrate::*}:
      set slot 1 of player's current inventory to loop-value
    chance of 100%:
      add 5 feather to {_ccratescrap::*}
    loop {_ccratescrap::*}:
      set slot 0 of player's current inventory to loop-value
on inventory close:
  wait 1 tick
  if event-block is ender portal frame:
    set event-block to air
Can someone tell me how I can make it to give 1 of the items guaranteed but also have chances? Cuz if I leave it like that there is a chance of leaving the slot empty
 
This is how I usually do chances (all of these have a 25% chance of occuring)
Code:
chance of 25%:
    send "1"
    stop
chance of 33%:
    send "2"
    stop
chance of 50%:
    send "3"
    stop
chance of 100%:
   send "4"
    stop
 
  • Like
Reactions: Jayden13O
This is how I usually do chances (all of these have a 25% chance of occuring)
Code:
chance of 25%:
    send "1"
    stop
chance of 33%:
    send "2"
    stop
chance of 50%:
    send "3"
    stop
chance of 100%:
   send "4"
    stop
I asked for a way to make it so u get 1 of the items with chance guaranteed so there won't be a chance of getting nothing, not something that I've already got
 
I asked for a way to make it so u get 1 of the items with chance guaranteed so there won't be a chance of getting nothing, not something that I've already got
The code given always gives 1 of the items and never 0, didn't you want a code to do that or am i wrong?
 
  • Like
Reactions: mj80
Status
Not open for further replies.