1

Detecting if a player's score in a scoreboard.

submitted 03/19/2018 11:26 pm by Ubalube
1 emerald6 replies • 76 views
Hi, So I have 2 scoreboards. 1 named ATA , and DTA! (Attacker Team Amount, Defender Team Amount) Both teams have a player named Amount. The scoreboard is a dummy score and everytime you join the game, it will do this command: /scoreboard players add amount DA 1. (Defender Amount) Same thing with the Attackers but this time it is AA (Attacker Amount). On leave the game, it is /scoreboard players remove amount DA 1. Same thing with attackers but its AA. And I have a testfor commandblock that does this: testfor @a[score_DA_min=0]

And when that happens, I have at Comparator that goes to another commandblock! If anyone can help, that would be great!
Posted by avatar
Ubalube
Level 44 : Master Technomancer
34

6 replies

1
03/20/2018 7:51 pm
Level 44 Master Technomancer
Ubalube
avatar
Sorry I am very confused, if you could walk me through it
1
03/19/2018 11:49 pm
Level 12 Journeyman Engineer
Heklo
avatar
Hi. This system works fine, but there is a much more efficient and faster way added with the /execute command (1.8+). This command forces entities matching the selectors to run a command. For your case, you would use the following command:


/execute @a[score_DA_min=0] ~ ~ ~ scoreboard players add amount DA 1


This basically makes everyone with a score on DA add 1 to the DA for the player "amount". I would recommend teams for separating groups though, example:


/scoreboard teams add [player] Defense

/execute @a[team=Defense] ~ ~ ~ scoreboard players add amount DA 1
1
03/20/2018 7:34 pm
Level 44 Master Technomancer
Ubalube
avatar
So there is no way to testfor a scoreboard player's score? Because what I said is not working. It cannot find the entity. But I did something and now it says [16:33:42] Selector '@a[score_DA_min=0]' found nothing.
The score DA is at 0 but it still isn't finding anything
1
03/20/2018 7:46 pm
Level 12 Journeyman Engineer
Heklo
avatar
So I think the problem you have is you're trying to check if someone doesn't have a score for DA. This cannot be done with objectives, as you are checking if they have a minimum of zero, and the default score for players does not exist, so it is not equal to zero. The only way to do this is with scoreboard teams, you can use a target selector @a[team=DA] to check for anyone on team DA, as well as @a[team=!] which just checks for anyone NOT on any team. Or you could use @a[team=!DA] which would select anyone NOT on the DA team specifically.

Search

Browse

Site

© 2010 - 2018
planetminecraft.com

Welcome