0

I'm creating a poker mini-game in Minecraft and I need a command block to be able to select two items, from a selection of 52, and give them to the player. So for example, I have three cards and I want the command block to choose two of them and give them to a player and then leave the last one sitting.

Here is the command's I would use to distribute:

/give @p minecraft:paper 1 0 {display:{Name:"Ace of Spades"}}

/give @p minecraft:apple 1 0 {display:{Name:"Four of Spades"}}

/give @p minecraft:redstone 1 0 {display:{Name:"Three of Spades"}}

How would I do this? I know it sounds like a request but I am unsure where to start here. I have tried making a randomizer with scoreboard objectives by setting the score of the player to a number below 52 ( <=) but that did not work.

That ^ is not a smiley face. :)

1
  • I think that I have found the answer to this through scoreboards.
    – Reflexive
    Commented Mar 7, 2017 at 16:58

1 Answer 1

2

So if figured this out with scoreboard objectives as I had originally tried. It was a little more complex than I thought, but it definitely works. So I made two scoreboard objectives to begin:

/scoreboard objectives add example dummy

/scoreboard objectives add example2 dummy

Afterwards, I made two repeating command blocks (Always Active) that added to the above objectives:

/scoreboard players add @a example2 1

/scoreboard players add @a example 1

Although I asked to be able to do this with 52 selections (Still Possible with this method) I instead gave this (for the example) 3 possible selections for each scoreboard objective, so in the end, you get two things.

You need to make two more repeating command blocks (AA) with the following commands:

/scoreboard players set @a[score_example_min=3] example 0

/scoreboard players set @a[score_example2_min=3] example 0

an image is best to show what happens here:

The thing I was just talking about .-.

Now we will fill in each command block with the command shown:

1: Gives the player an apple

/give @a[score_example=1,score_example_min=1] minecraft:apple

2: Gives the player a paper

/give @a[score_example=2,score_example_min=2] minecraft:paper

3: Gives the player a redstone

/give @a[score_example=0,score_example_min=0] minecraft:redstone

A: Gives the player a stone

/give @a[score_example2=1,score_example2_min=1] minecraft:stone

B: Gives the player a piece of Wood

/give @a[score_example2=2,score_example2_min=2] minecraft:log

c: Gives the player a brick item

/give @a[score_example2=3,score_example2_min=3] minecraft:brick

Now place a button behind the redstone behind command block two, and press it :D .

I didn't add the Custom Names because I thought it was to much trouble. And also it isn't completely random but it was the best I could make.

Not the answer you're looking for? Browse other questions tagged or ask your own question.