Minecraft Blogs / Tutorial

Using the Scoreboard 1.8

  • 65,503 views, 2 today
  • 73
  • 37
  • 78
Headaxe's Avatar Headaxe
Level 55 : Grandmaster Technomancer
421
USING THE SCOREBOARD 1.8
-a complete guide on all commands of the Scoreboard
There are several reasons for not using the scoreboard.
Some don't get what individual commands do while others couldn't find a good list with senseful explenations of all the commands.
But both these issues are no problem after reading this blog.
Even though it's hard work to learn all the tricks, working with the scoreboard gives you unbelievable new possibilities as a map creator and therefore it's more than worth it to invest time into the studies.


Instructions on reading this blog
I used a couple of color codes and other techniques in this blog, which you should better understand before reading.

(round brackets)A part of the command, you have to add to perform it
[square brackets]A part of the command, you can add if you want to

Blue
A scoreboard command
OrangeA list of options in a command, you can choose between
GreenAn example for the usage of the scoreboard



Full Guide
/scoreboard objectives
/scoreboard objectives list
Using this command allows you to see a detailed list of all objectives you added to the world.
/scoreboard objectives list

/scoreboard objectives add/remove
This command allows you to add objectives or to remove them.
When you are creating an objective, you'll have to add a criteriaType.
You can choose between 5 different types.
You can only remove objectives that already exist.
The internal name is always the name used in operations and more, while the display name only appears on lists and more.
Objective types
dummy: If somebody has an objective value/score with a criteria type named dummy, he won't be able to change the value by hand. The only way to change the value then, is to use a /scoreboard players command.
health: This type reflects your hearts. If you have 10 hearts, the score is 20.
totalKillCount: You get 1 point for killing any player, mob or animal.
playerKillCount: You get 1 point for killing any player.
deathCount: You get 1 point for each respawn.
achievement.(internal achievement name): Checks if you have earned a certain achievement
stat.(internal stat name): Tests for several actions like walking, being hit, falling and much more
stat.craftItem.(Item ID): Tests for crafting a certain item or block
stat.useItem.(Item ID): Tests for using an item (placing blocks, throwing eggs...)
stat.breakItem.(Item ID): Tests for breaking an Item (Mining with tools)
stat.mineBlock.(Block ID): Tests for amount of one type of blocks mined
stat.killEntity.(Mob ID): Tests for amount of one type of mobs killed by the player
stat.entityKilledBy.(Mob ID): Tests how often the player was killed by one type of entities
stat.teamkill.(team color): Checks how many team members with a certain team color were killed by the player
stat.killedByTeam.(team color): Checks how often the player was killed by team members with a certain team color
You can add a custom name for your brand new objective too.
/scoreboard objectives add (internal objective name) (objective type) [display objective name]
/scoreboard objectives remove (internal objective name)

/scoreboard objectives setdisplay
People want to see their score, money, values or other people's hearts.
If you want to add this function, you can choose between three different display slots.
Remember that you can only put existing objectives into a setdisplay slot.
Display Slots
sidebar: Your score will be displayed at the right side of the screen.
Scores of players who aren't online get displayed too, so you can use this as a highscore list.
sidebar.team.(team color): The sidebar is only visible to players that are member of a team with a certain team color
belowname: If you are in a distance of 20 blocks to an other player, you will be able to see his score below the player name.
list: Press tab and the score will be displayed next to the name of a player.
If you don't add a name after the display slot, the slot will get cleared.
/scoreboard objectives setdisplay (display slot) [internal objective name]

/scoreboard players
/scoreboard players add/remove/set
This is the most essential command for interacting with player scores.
By using it you are able to modify a players score.
You can even add scores to nonexistant players, so they just exist for counting or multiplying scores etc.
Player names that are not supposed to appear in the sidebar or other lists, have to start with a ''#''.
Also, in 1.8 the option of selecting players with data tags in this command was added, so you are able to modifiy the value of entities and players, who have a specific tag.
This makes it possible to translate Data Tags into scoreboard values, which also makes a lot more things possible.
/scoreboard players remove (player) (internal objective name) (amount) {Data Tag}
/scoreboard players add (player) (internal objective name) (amount) {Data Tag}
/scoreboard players set (player) (internal objective name) (amount) {Data Tag}
/scoreboard players set #(player) (internal objective name) (amount)
Please remember, that you have to add extra charakters to the Data Tag Parts depending on the type of of the Part, you are trying to involve.
/scoreboard players set @e air 1 {Air:20s}


/scoreboard players reset
By using this command, you can reset all scores a player reached or reset one objective score a player reached.
''*'' is a new 1.8 selector which targets everyone tracked by the scoreboard.
Using it will reset everyone's score, even if they are not online, which is helpful when your sidebar is spammed with
player scores that are not even online and you don't want that.
/scoreboard players reset (player) [internal objective name]
/scoreboard players reset *


/scoreboard players list
Use this command to see the scores of different players or to see all players tracked by the scoreboard.
Without using a name, you can list all players tracked by the scoreboard.
By adding a name you can see all scores somebody has.
''*'' is a new 1.8 selector which targets everyone tracked by the scoreboard.
By using it as a player in this command you get every score of everyone tracked.
/scoreboard players list [player]
/scoreboard players list *

/scoreboard players test
Tests if a player has a score in a certain objective that's between a minimum score and an optional maximum score.
The command is much easier to use than the old /testfor way of testing.
Besides that, the player you are testing for mustn't be online or even existing, you can test for anything and anyone you want.
/scoreboard players test (player) (internal objective name) (min player score) [max player score]

/scoreboard players operation
That command is actually working like a calculator and helps you adding scores to each other, multiplying scores and much more.
The player you are calculating with, doesn't even has to be online, so you can use ''ghost'' players aswell.
Operation types
+= Adds the source player's source score to the target player's target score

-= Removes the source player's source score from the target player's target score

*= Multiplies the source player's source score with the target player's target score

/= Divides the target player's target score through the source player's source score

%=Modular Division: takes the target player's score and divides it by the source player's score, and then saves the remainder into the target players score.

=   The target players' score is being turned into the source players' score.

>< Swaps the score of the target player and the source player

<  Checks for the target player's score and the source player's score and turns the target player's score into the lowest value

>  Checks for the target player's score and the source player's score and turns the target player's score into the highest value

/scoreboard players operation (target player) (internal target objective name) (operation type)
(source player) (internal source objective name)

Advanced operation tutorial
Percentage Operations
By combining operation types, you can get interesting effects.
By first multiplying something by 120, and then dividing a value through 100, you add 20% to the existing score.
Also, by multiplying something by 3965 and then dividing it through 1000, you could set a score to precisely 396.5%
This is useful when you want to have a system that adds or removes a certain percentage to the score.
And that is really useful when having to use high precision calculation with comparably low, full numbers.

/scoreboard players operation (selector) (internal objective name) *= (selector) a
/scoreboard players operation (selector) (internal objective name) *= (selector) b
Δx%=a-b


This command is the most complicated part of the scoreboard, so I will explain you it a bit further.

The target player is always the player who's score will get affected in the end.
Whatever what operation you perform, the source players' score will not be modified.
The target objective is the objective which is going to be affected by the operation.

The operation type defines how source player and target player interact in the operation.

The source player is the player who's score is being added, removed, synchronnized etc. from/to/with the target player's score.
The source objective selects the objective that the source player is adding/removing etc. from/to/with the target player.

Here comes an extremely stupid example ^^: 
SethBling's coolness: 100 | Minecraft's redstone: 50
/scoreboard players operation SethBling coolness += Minecraft redstone
In this example Minecraft's 50 redstone would be added to SethBling's 100 coolness, which would mean that SethBling's coolness score is now 150.

/scoreboard teams
/scoreboard teams list
Use it to list all teams you created without adding a team name or check which players are in a certain team.
/scoreboard teams list [internal team name]

/scoreboard teams add/remove
Create or remove teams.
When you are creating a team you can type the system name first and then add a display name.
/scoreboard teams add (internal team name) [display team name]
/scoreboard teams remove (internal team name)

/scoreboard teams join/leave
You can join/leave a team, you created or let other people join/leave the team. If you use the command without a player, you will get selected as the person to join/leave the team.
/scoreboard teams join (internal team name) [player]
/scoreboard teams leave [player]

/scoreboard teams option
Use this command to customize a team.
There are several things you can change in a team, that affect it's appeareance or  the interaction between the players within a team.
Options
color: Select a display color for your team. The nametags of players will change their color to the team color you selected. Choose between "black", "dark_blue", "dark_green", "dark_aqua", "dark_red", "dark_purple", "gold", "gray", "dark_gray", "blue", "green", "aqua", "red", "light_purple", "yellow", and "white".

friendlyfire: Tells if players in one team can attack each other. The option does not effect lava, potions, tnt, or other indirect attack sources. Choose between ''true and ''false''.

seeFriendlyInvisibles: Allows you to see a transparent player model of your team members, while they are invisible. Choose between ''true'' and ''false''.

nametagVisibility: Affects which people are able too see you team's nametag.
Choose between:
''never'': No one see's your nametag
''hideForOtherTeams'': Other teams can't see your nametag
''hideForOwnTeam'': Your own team can't see your nametag.
''always'': Everyone can see your nametag.

/scoreboard teams option (internal team name) (option) (value)

/trigger
Adding triggers
Triggers are nothing but a very special type of scorebaord objectives.
Unlike other objectives, you can let players that aren't even operators use a trigger command.
In order to create such an objective, use:
/scoreboard objectives add (internal objective name) trigger (display objective name)

Enableing triggers
A player has no right or permission to activate a trigger, unless you enable the trigger for the player.
This way you can define at which point a player is permitted to activate a mechanism, how often, how, etc.
/scoreboard players enable (selector) (internal objective name)

Using triggers
A player that is able to use a trigger can activate it in all kinds of ways.
They can simply use the command for triggering themselves or use it in a tellraw command in books, on signs, in chat etc.
/trigger (internal objective name) add (value)
/trigger (internal objective name) set (value)

/stats
/stats ... clear
With this setting you can reset, what stat type is being transformed into a scoreboard value after the command has been executed.
Normally, all command blocks or entities don't have any set type of stats, being transformed into a scoreboard value.
/stats entity (selector) clear (stat type)
/stats block x y z clear (stat type)

/stats ... set
Allows you to transform a statistic into a scoreboard value of a specified entity or player.
Statistics are being gathered by letting a command block execute a command or by using /execute on an entity.
The entity which executed the command will save several types of results.
The first part of the command always specifies, where you gather the information while the second part always specifies where you save the information.
Obviously, you can only gather information from command blocks and existing entities.
You can't gather information from other blocks or from nonexistant players, saved in the scoreboard.
However,

1.  You can save information on nonexistant players, saved in the scoreboard, but they have to have an existing score before you do so already
2. A /stat command is not taking existing information from a command block, but telling a command block/entity to save the information somewhere.
You can only track one stat type at a time and once you have told a command block/entity to save a stat, it will always do so until you use /stats...clear on it.
3. Your command does not have to change something in order to save information in "Affected" stat types.
You can also use commands that gather information, such as /clear...0, /time query, /worldborder get, /testfor and many, many more.

(Warning: Using fast clocks on command blocks can lead to not fully storing the stats)
Stat Types
SuccessCount: Shows, wether the last command has been successful or not in most cases.
Defines the signal strength that is being output by comparators which means that only a couple of commands like /testfor can set the SuccessCount to something higher than 1

AffectedBlocks: Shows, how many blocks the last command affected

AffectedEntities: Shows, how many entities the last command affected

AffectedItems: Shows, how many items the last command affected. (Not Items on the ground, but items in a player's inventory that are being affected by commands like /replaceitem or /clear

QueryResult: A stat, that tracks the result of a command. This can be the result of an operation, or of commands that gather information such as "/time" query gametime or "/worldborder get"

/stats entity (selector) set (stat type) (target selector) (internal objective name)
/stats block x y z (stat type) (target selector) (internal objective name)

Player selection
If you want to interact with command blocks, you can add some scoreboard based arguments.
As you know, you can use @p @a and @r to select different players.
You can add special arguments to this players-selections.
In 1.8 you are able to select all entities using @e.
@a[score_money=100,score_money_min=100]
Will select all people who have a minimum score of 100 and a maximum score of 100.
@r[team=red]
Will select a random player, who is member of team red
@p[team=]
Will select the nearest player, who is member of no team.

Read the wiki article about Command Blocks, if you want to find out all about arguments.



Solutions for common problems
Autocomplete in commands
The scoreboard contains a lot of different types of objectives, different options for teams and much more which you would normally have to remember in order to use them.

It's obvious, that no one can remember all these different settings, however there is one button which saves your day.
Pressing tab automatically completes the part of the command, you are currently working on.
So before actually asking for support on this blog or searching the wiki for lists of objectives and more, simply try to find things out yourself by using the autocomplete function.

/scoreboard objectives add coins d -> *presses tab* ->  /scoreboard objectives add coins dummy

Negative testing
Negative testing
If you want to test for something negative, for instance if a player does not have an item, if a player is not inside an area, if a player is not holding an item in their hands, then you have to use at least two command blocks.

Command blocks that are connected to a /fill clock or to the same redstone wire seem to be activated in the same moment, but they get activated in a certain order.

To test for something negative, enter the following command in the first command block:
/scoreboard players set selector objective 0
Then enter:
/scoreboard players set selector[...] objective 1 {...}

By using this method, the score will never fall to 0 unless you don't have the item or unless you aren't in the area etc.
To then select people who fulfill the negative requirement, simply use
@a[score_objective=0]
By replacing "set" with "remove" or "add" in the commands, you can also test how many ticks the player doesn't/does fulfill the requirements already.

Displaying several objectives in the sidebar
Displaying several objectives in the sidebar
On singleplayer or coop maps it is not very senseful to display just one objective in the sidebar for several players.
To change the function of the sidebar, create a new objective called "stats" and let it be displayed in the sidebar.
/scoreboard objectives add stats dummy
/scoreboard objectives setdisplay sidebar stats

Then use operations to get your own scores into the sidebar, using operations. You shall use nonexistant players for displaying your scores.
/scoreboard players operation Money stats = @a money
/scoreboard players operation Health stats = @a health
/scoreboard players operation Level stats = @a level

To make the sidebar even fancier, add these nonexistant players to a team, which uses a certain color.
/scoreboard teams add yellow
/scoreboard teams option yellow color yellow
/scoreboard teams join yellow Money

Precise Time measuring
Precise time measuring
To measure time, many people use clocks that add 1 scoreboard value per second to a certain player.
However, this method is comparably inaccurate, because every single bit of lag caused by tnt, redstone and more already slows this process down.
When you have a parkour map or a map that includes speedrun features, it is highly recommended to use this method.

What you can do is measuring time, usng the worldborder.
First, add a new objective called "time"
/scoreboard objectives add time dummy

Then create an armor stand or something else, that will save the scoreboard value inside your spawn chunks.
Start by setting the world border to a comparably high value.
/worldborder set 1000000 (1 Million)
Continue by letting the worldborder expand by one block per second.
/worldborder set 2000000 1000000 or
/worldborder set 60000000 59000000
Unlike a clock powered by ticks the worldborder expands using an external process.
No matter how much lag is being caused, the world border will progress normally.

All you have to do now is getting the value of the worldborder (in a command block).
/worldborder get
The command block has saved the value as a QueryResult (result of a command) now.
All you have to do now is transforming this result into a scoreboard value.
/stats block x y z set QueryResult Time time
Remember, the x y z coordinates hace to be the coordinates of the command block with the saved QueryResult.

The last two commands have to be connected to a comparably fast clock.
The last command block, which has to be triggered as last will now remove the initial 1M blocks from the value.
/scoreboard players remove Time time 1000000

To display the time in the sidebar, use the previous method.
/scoreboard objectives add stats dummy
/scoreboard players operation Time stats = Time time

/scoreboard objectives setdisplay sidebar stats

Adding new gamerules
Adding new gamerules
Sometimes doing this is worth the effort.
Certain multiplayer maps or even singleplayer maps allow the operator to change the map's experience.
/gamerule commands are the most obvious way to do so.
/gamerule (gamerule name) [value]
You can create new gamerules by giving a gamerule a value.
/gamerule respawntime 100

You can enter anything you want as a value, but only if it is a number, you'll be able to save it as a scoreboard value.
Continue by making an armor stand with a custom name, that you can use to save results.
(The following steps are not possible with /stats block)
/summon ArmorStand x y z {CustomName:"respawntime"}
Also remember that the ArmorStand has to be loaded, so it has to be near a player or inside the spawn chunks.

The following command should be connected to a comparably fast clock.
/execute @e[name=respawntime] ~ ~ ~ /gamerule respawntime

The value, the ArmorStand returns will be the current number, saved as the setting for "respawntime".
To now transform the armor stand's result into a scoreboard value, use:
/scoreboard objectives add gamerule dummy
/stats entity @e[name=respawntime] set QueryResult @e[name=respawntime] gamerule


What this entire setup does, is transforming the current setting for "respawntime" into the gamerule-score of the armor stand "respawntime".
This system allows you to use any kind of system to change the gamerule.
You can adjust settings by using /tellraw data in books, on signs, in chat etc.
But you can also set the gamerule by hand at any given time or by using a command block, connected to a button.
All that possibilities make this gamerule system extremely convenient and an easy way to allow players to modify settings on your map.

Combining scores
Combining scores
This method helps you create statistics for groups of players, for an entire server and for teams.
Let's say, you have a basic PVP map with two teams.
The gamemode is "Team Deathmatch", the team with the most kills in total wins.
The problem at this point would be, that all players save their scoreboard values individually instead of directly sending them to a team.

First, create an objective to track teamkills.
/scoreboard objectives add killsRed teamkill.blue
/scoreboard objectives add killsBlue teamkill.red

(the color at the end of the objective type specifies the team's current color, not the internal team name)

To combine those scores, place to command blocks, connected to a clock.
The order in which the command blocks are being activated is important.
/scoreboard players set RED killsRed 0
/scoreboard players operation RED killsRed += * killsRed
/scoreboard players set BLUE killsBlue 0
/scoreboard players operation BLUE killsBlue += * killsBlue
The reason, you're using the selector "*" is simply the fact that you could reduce the amount of kills, your team made by logging out during the match which wouldn't be realistic.

You can combine all kinds of different scores this way.
Instead of using it for competitive maps you could also use the system for adding a "total amount of money gathered" on a server or other global statistics that might be worth keeping.



Toolbox
OCTAFONT C5: Charakter Highlighting (Resource Pack)
Sometimes commands can become extremely long and complex.
Especially brackets in data tags can be hard to see through after entering one or two lists, 10 data values and more.
To give the user a bit more overview, this resource pack (which comes in various colors) gives brackets a certain color, but also colors all charakters, involved into commands such as "~ , ! + ="  and more.

undefined

Command Syntax Mod: Syntax Highlighting (Mod for 1.8+)

The is mod is way more advanced than the previous resource pack as you ca see.
However, it requires forge and mod installation.
Due to more and more additions such as Autocomplete in Command Blocks and most likely adding color codes to command blocks IN THE GAME soon, it is a modification that should be just as part of your routine installation like NBT-Edit, MC-Edit, NEI/TMI and more.

undefined















~THE END~

















If you want to read more nice tutorials:



                                 undefined 
CreditHeadaxe
Tags

12 Update Logs

Toolbox : by Headaxe 01/03/2015 8:51:58 amJan 3rd, 2015

+added section: Toolbox
 ->added "OCTAFONT C5"
 ->added "Command Syntax Mod"
+improved and re-color coded the section "advanced operation types"
+smaller fixes
LOAD MORE LOGS

Create an account or sign in to comment.

1
11/09/2016 12:32 am
Level 13 : Journeyman Engineer
Wombatlord
Wombatlord's Avatar
How do I make all this stuff visible to 1 player

E.g.
for a server I want 1 person to have 10 coins and another to have 0

How do I do that?!
1
09/22/2016 12:43 pm
Level 1 : New Miner
JaxBen98
JaxBen98's Avatar
THIS ISN'T HELPING MY MAP
1
09/22/2016 12:44 pm
Level 1 : New Miner
JaxBen98
JaxBen98's Avatar
i got the objective now i can't get the scoreboard on the side of the screen
HELP
1
01/28/2016 10:32 pm
Level 1 : New Miner
Andrewmacor
Andrewmacor's Avatar
Is this a dead post?
1
01/29/2016 7:01 pm
Level 55 : Grandmaster Technomancer
Headaxe
Headaxe's Avatar
No, I just have very little time to make changes to it at the moment.
I will update it to the latest standards very soon.
1
01/26/2016 11:53 pm
Level 1 : New Miner
Andrewmacor
Andrewmacor's Avatar
So, in the Displaying several objectives in the sidebar section; in the command example (/scoreboard players operation Money stats = @a money), for some reason, even though the target is @a, it does not show each player's own score. Instead it chooses a random player that is online in the server and displays his score to the rest of the players.  I'm running a minecraft  realms server getting ready to make it public, but I have to fix this and some other stuff to call it done.  This situation is one of the problems that call my attention the most. Please help!!
1
09/13/2015 5:03 pm
Level 45 : Master Engineer
Nephalem
Nephalem's Avatar
Really nice list, keep it updated!
1
07/20/2015 12:28 pm
Level 55 : Grandmaster Engineer
Veritas025
Veritas025's Avatar
This is very useful but you should also mention stuff about using scoreboards in testfor lik /execute @a[score_killZombie_min=1000] /give @a diamond_block. Like you can give a diamond block to whoever kills 1000 zombies when you have /scoreboard objectives add killZombie stat.killEntity.Zombie or /testfor @a[score_killZombie_min=1000] then have a comparator doing /give @a[score_killZombie_min=1000] diamond_block
1
07/16/2015 11:39 am
Level 1 : New Crafter
Ustinich
Ustinich's Avatar
I need help.
I want to make a mechanism that will check the sameness of Points players.
For example a player has 10 points and the other player has 10 points in the Scoreboard. It is checked, and then run the command. Please, help!
1
07/17/2015 4:01 pm
Level 55 : Grandmaster Technomancer
Headaxe
Headaxe's Avatar
So basically, first you put the score of player #1 into a new temporary objective using an execute operation.
Afterwards, you subtract the second player's score from that temporary score.

If the temporary score is now 0, the two scores are equal and you can use an execute off the first player if they have a score of 0 in the temporary objective.
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome