1

I am making a minigame when two players are needed to start an arena ! Trying with the c selector for count, but it seems that doesn't work This is the command I used:

/testfor @a[score_arena_min=1,score_arena=1,c=2]

The arena scoreboard notes the players who joined an arena, the 1 value being for arena 1.

Command block image

Can someone give me another solution than that?

1 Answer 1

1

The c parameter is to limit the maximum number of targets to obtain rather than a minimum. For example, if there were 3 possible matches while c was set to 2, only the 2 closest would be selected. If there were only 1 target possible, then only that target is obtained.

Since you know the exact score and number of players you want to look for, you can check the command block's SuccessCount integer tag value without changing the command you're using. If it's 0, then no players were found. If it's 1, then only 1 player was found. If it's 2, then 2 (or more) players were found with that score.

Repeating > Chain > Conditional Chain

  1. The command you're currently running which will set the command block's success count appropriately.

    /testfor @a[score_arena_min=1,score_arena=1,c=2]
    
  2. Check the command block's SuccessCount value to ensure it is 2. Modify the XYZ coordinates to target the repeating block.

    /testforblock X Y Z minecraft:repeating_command_block -1 {SuccessCount:2}
    
  3. Conditional. Action to perform as a result of there being at least 2 players that matched.

    /say Starting with players: @a[score_arena_min=1,score_arena=1,c=2]
    
1
  • thank you so much! I don't though the solution was that simple.
    – iDoomfull
    Commented Jul 1, 2016 at 19:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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