Minecraft Blogs / Tutorial

[Discontinued] [C|T #2] The scoreboard - objectives, players and teams!

  • 1,770 views, 2 today
  • 6
  • 2
  • 4
Bertiecrafter's Avatar Bertiecrafter
Retired Moderator
Level 70 : Legendary Engineer
775

This series is discontinued. Have a look at my new series about data packs (1.13+).


In the CBT (Command Tutorial) series
I will be giving tutorials on commands.

From here, I assume you know how to use commands and their arguments.
I strongly recommend reading [​C|T #1] The basics, before starting on this tutorial.

What is a scoreboard?
A scoreboard is a place where you can store one integer for each player, entity or imaginary name for every objective (list of names and values),
whether you want to show them or not.
You access the scoreboard with the command /scoreboard

Objectives - A place to store

An objective describes what it records and how it's increased or decreased. Every objective has an internal name, a type and an external name. The internal name has special requirements and is used in the commands, the type indicates how it needs to be increased or decreased and the external name can be anything (even allows spaces). The external name is used if you decide to show your objectives (if available).

The following commands are available:
/scoreboard objectives add <name> <type> [​external name]
/scoreboard objectives remove <name>
/scoreboard objectives list, this shows all objectives
/scoreboard objectives setdisplay <place> [​name], this clears the spot if no name provided, otherwise displays that objective on that spot.

Available spots:
- belowName
- list (tab list)
- sidebar (on the right, ordered by the values, from high to low)
- sidebar.team.<color> (use tab to autocomplete)

Examples:
- /scoreboard objectives add State dummy
(Does nothing, you can use it manually to store values. It's the only one that never increases on it's own, although you can edit most others).
- /scoreboard objectives add Kill trigger
(This does nothing, but allows non-op players to edit the value if enabled for them.)
- /scoreboard objectives add Health health ❤
(Tracks the health of each player and displays as a heart icon.
Any unicode character can be used, not all display in mc.)
- /scoreboard objectives add Dead deathCount
(Tracks the amount of times you died)
- /scoreboard objectives add Jump stat.jump
(Tracks the amount of times you jumped)
- /scoreboard objectives add Blaze stat.killEntity.Blaze
(Tracks the amount of Blazes you killed)

All objectives can be found on:
http://minecraft.gamepedia.com/Scoreboard#Criteria

Players - Naming, storing and listing your values!

You use the players command to edit the values of players, entities or imaginary names. A name starting with a # doesn't show up on the sidebar. It's also used for listing an a couple other operations.

Available commands:
/scoreboard players <add|remove|set> <player> <objective - internal name> <#> [​dataTag], this edits a value. For player, any playername, UUID, string or selector (@p, @a, etc) can be used. The dataTag can be used in combination with the selector for more specific filtering. More about data tags in another tutorial.
/scoreboard players reset <player> [​objective], resets the score for a "player" on any objective or only one if specified. Remember: storing a 0 is different than having no score!
/scoreboard players list [​player], lists all recorded players or all stored scores of one player.
/scoreboard players enable <player> [​objective], allows the non-op player to edit the value using the /trigger <objective> <set|add> <#> command, provided that the objective is type "trigger". The command only enables a player to execute the /trigger command once, so it's very common to put this command on a redstone clock.

Others will be explained below, they are more advanced.

Using the scores in commands + Players: Test

You can use /testfor @a[​m=1] and then add a comparator and another command block with /gamemode 0 @a, instead of simply /gamemode 0 @a[​m=1].
In a similar fashion, you can use /scoreboard players test <player> <objective> <min> [​max] in combination with a comparator and another command block, instead of a more flexible solution as well.

Instead, you should use the selector arguments "score_<obj>[​_min]=<#>".
Keep in mind that score_obj=# indicates the maximum score, not the exact score!

Example:
- /scoreboard objectives add health health
- /effect @a[​score_health_min=0,score_health=6] instant_health 1 0 true

This makes sure that everybody with their health between 0 and 6 get more health. In this case, I could have omitted the minimum number (health doesn't go below 0).


Now you should understand the basics of the scoreboard, continue reading if you want to know more.



Players: Tag

Instead of using a dummy objective and storing either a 1 or 0 for a player as "true" or "false", you can also indicate this with tags.

Available commands:
/scoreboard players tag <player> <add|remove> <tagName> [​dataTag]
This modifies the tag list, use dataTag in combination with player to select the right things. More on data tags in another tutorial.
/scoreboard players tag list
Lists all tags

Used in the selector: @a[​tag=<tag>] or @a[​tag=!<tag>]
Only one "tag" selector argument can be used in each selector, so that's why I recommend to simply use objectives instead. Comparison between tags and objectives with only a 0 or 1:
Objectives:
@a[​score_a=0,score_b_min=1]
@a[​score_a=0,score_b=0,score_c_min=1]
@a[​score_a_min=1]
@a[​score_a=0]

Tags:
x
x
@a[​tag=a]
@a[​tag=!a]

Players: Operation

This applies logical operations to the target player.
/scoreboard players operation <targetName> <targetObjective> <operation> <selector> <objective>

Valid operations (copied from the wiki page):
"+=" Addition: add selector's score to targetName's
"-=" Subtraction: subtract selector's score from targetName's
"*=" Multiplication: set targetName's score to the product of targetName and selector's scores
"/=" Integer Division: set targetName's score to itself divided by selector's score
"%=" Modular Division: set targetName's score to the remainder of the division between itself and selector's score
"=" Assign: set targetName's score to selector's score
"<" Min: if selector's score is less than targetName's score, then set targetName's score to selector's score
">" Max: if selector's score is greater than targetName's score, then set targetName's score to selector's score
"><" Swaps the scores of selector with targetName

Because you need to work with selector values, instead of simple numbers, it often happens that a fake player is made in order to do the calculation. Also, targetting/selecting more than one player can be dangerous and the command could have unexpected behaviour, that's why /execute is often used to execute the command for multiple players.

E.g, we want to display the Items score in stacks of 64:
/scoreboard objectives add Items dummy
/scoreboard players set @a Items 128
/scoreboard objectives add Stacks dummy
/execute @a ~ ~ ~ /scoreboard players operation @p Stacks = @p Items
/scoreboard players set #Decrease Stacks 64
/execute @a ~ ~ ~ /scoreboard players operation @p Stacks /= #Decrease Stacks

Now in text:
Create a place to store the amount of items
Remember that everyone has 128 items
Create a place to store the amount of stacks
Clone all Items scores to Stacks
Add a fake player with the number that it needs to be devided by.
Devide all Stacks scores by the score we stored earlier (64)

Teams - Grouping players, with properties!

Using teams is a way to group players and give them properties.

Available commands:
/scoreboard teams add <name> [​display name]
/scoreboard teams remove <name>
/scoreboard teams list [​name], provides a list of teams or all players in a team.
/scoreboard teams <join|leave> <name> [​player], makes you or a specified player join or leave a team.
/scoreboard teams empty <name>, empties a team.
/scoreboard teams option <name> <option> <value>

Available options (defaults are in bold):
- collisionRule (always, never, pushOtherTeams, pushOwnTeam)
- color (press tab to autocomplete, the colour is applied to the glow effect, nametag and name in chat, default is reset)
- deathMessageVisibility (always, never, hideForOtherTeams, hideForOwnTeam)
- friendlyfire (true, false. No matter what the settings are for your server, this value is always true by default. When false it doesn't allow pvp, when true it only allows pvp if it's globally allowed through the server settings if on multiplayer.)
- nametagVisibility (always, never, hideForOtherTeams, hideForOwnTeam)
- seeFriendlyInvisibles (false, true)

Usage in commands:
@a[​team=.....] - all players in THAT team
@a[​team=] - all players who in no team
@a[​team=!....] - all players who are not in THAT team
@a[​team=!] - all players who are in any team

[Discontinued] [C|T #2] The scoreboard - objectives, players and teams!
[Discontinued] [C|T #2] The scoreboard - objectives, players and teams!
My Server: GIBI
[Discontinued] [C|T #2] The scoreboard - objectives, players and teams!
Click the banner for more info!
Tags

1 Update Logs

Update #1 : by Bertiecrafter 06/03/2017 3:59:52 pmJun 3rd, 2017

Updated information to 1.12.
Rebranded due to function files being added soon.

Create an account or sign in to comment.

1
02/01/2017 10:42 am
Level 70 : Legendary Engineer
Bertiecrafter
Bertiecrafter's Avatar
Thank you catmelonhat, camo_scout and pettyGamingHD for the diamonds! =)
1
02/01/2017 10:22 am
Level 1 : New Explorer
camo_scout
camo_scout's Avatar
Thanks this was helping! I learned something new with your Tutorial!

(I also may join that server later!)
1
02/01/2017 10:39 am
Level 70 : Legendary Engineer
Bertiecrafter
Bertiecrafter's Avatar
Thanks!
1
02/01/2017 10:47 am
Level 1 : New Explorer
camo_scout
camo_scout's Avatar
NP Homie
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome