Solved Random slot choosing

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

WiebeHero

Active Member
Aug 23, 2017
135
5
0
23
Hello everyone! Im Wiebie, and i got a little bit of an issue. I have been trying to make a skript for a lootchest that puts certain loot in the loop-block's inventory (The chest)
But i cant put 1 thing down right, i want it to make it so that the items that are put in the chest, are put in random slots and not just filling up from the beginning.
Any ideas?
Code:
command /chest1:
    trigger:
        loop blocks in radius 1 around {chestloc}:
            if loop-block is a chest:
                clear loop-block's inventory
                set {_item} to a random number between 3 and 6
                loop {_item} times:
                    set {_randomitem} to random element out of {random.item.list::*}
                    add {_randomitem} to the loop-block's inventory
 
code_language.skript:
set {_slot} to random integer from 0 to 26
set slot {_slot} of loop-block's inventory to {_randomitem}
 
Status
Not open for further replies.