Solved gui custom loot and 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!

CringeBoy

Active Member
May 20, 2021
65
0
6
Romania
So if you right click on a block to open a gui and have a chance to drop what items you choose and also have a drop chance of that item
 
Code:
on right click on chest:
  cancel event
  open virtual chest inventory with size 1 named "Chest Loot" to player
  #
  chance of 10%:
    add dirt to {_items::*}
  chance of 15%:
    add iron sword named "test" to {_items::*}
  #
  loop {_items::*}:
    format gui slot loop-number of player with loop-value
 
Code:
[ERROR] There's no loop that matches 'loop-number of player' (toolbox.sk, line 11: format gui slot loop-number of player with loop-value')
I am getting this
 
Replace
Code:
  loop {_items::*}:
    format gui slot loop-number of player with loop-value

with
Code:
    set {_x} to 0
    loop {_items::*}:
        format gui slot {_x} of player with loop-value
        add 1 to {_x}
 
There is a problem. You remember that u made me a recycler right ? So when I try to loot the item, it won't let me take it, the item is replacing automatically back.
[doublepost=1622067056,1622066895][/doublepost]
Code:
on inventory click:
  if clicked raw slot = 3 or 4:
    execute console command "ecraft open invcraft %player%"
Also I have this to execute a command on inventory crafting click and if I press in the gui in the 4th and 5th slot it will execute the command.
 
There is a problem. You remember that u made me a recycler right ? So when I try to loot the item, it won't let me take it, the item is replacing automatically back.
[doublepost=1622067056,1622066895][/doublepost]
Code:
on inventory click:
  if clicked raw slot = 3 or 4:
    execute console command "ecraft open invcraft %player%"
Also I have this to execute a command on inventory crafting click and if I press in the gui in the 4th and 5th slot it will execute the command.

My bad try:
Code:
set slot {_x} of player's current inventory to loop-value


and a gui starts at slot 0