Solved Randomly adding items into a chest

  • 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 community!

    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.

JackyBoy

Member
Feb 4, 2017
104
1
18
Hey there, I am trying to create a cool new system where if you do a command such as /chest it will spawn a chest beside the player and in the chest there will be random items from this list (Iron boots, iron sword or diamond sword) is there any way that I can do this using skrip?
 
You can put the items that you want on a list var, set another var to the integers from 0 to the amount of slots of that inventory and then select a random element from the integers list & the items list, loop the amount of slots on the inventory times, remove them from their list variables the items wouldn't be duplicated or replaced in that way) and finally set the slot of the randomly selected integer from the integers list to the randomly selected item from the items list.
 
Status
Not open for further replies.