Blogs Article

Minecraft command block tutorial. Part 1 - Scoreboard and testfor

  • 1k views 0 today
  • 1
  • 0
  • 2
VKG147
Lvl 7Apprentice System
0
Hey guys VKG147 here. This is my first part of my blog series that I will be doing (if there will be any people that would actually read it). In this blog I will go through all of the basics of command blocks and later on I will get to more advanced stuff.
   
    So let's start. A command block is a block that is once triggered by any kind of power source (etc. A button, redstone dust, redstone torch...) triggers a command that is within the command block. Also since the new updates once the command is runned in the command block itself an output will be displayed. For an example I typed in this command /scoreboard players set test @p 1 (I would never type that so incorrectly but this is just an example) and then activated it, in the command block this appeared: "No objective was found by the name '@p'" so then I realize that where I typed @p should be an objective name!

   Okay let's stop the very very basics and start actually learning stuff.<br> How about we learn the basics of "scoreboard" command and the "testfor" command because they are one of the most often used commands (well atleast for me). Okay so let's start with the scoreboard command. The first command that we are looking at looks like this: "/scoreboard objectives add (objective name) (cryteria) (optional display name)". What this will do is it will add a new objective with a name that you specify and a cryteria that you need to specify. These are the basic cryteria's: dummy. totalKillCount, killCount, deathCount and health (note that you need to use the EXACT same puctation for this to work). If I add an objective with the cryteria type "dummy" I can only change the score of this objective ONLY with command blocks or commands. If I add totalKillCount I can change the score with commands, command blocks and I can also change my score by killing anything (mob or a player), once I kill anything my score of this objective is raised by 1. If I add an objective with the cryteria killCount I can change it with a command, command block or by killing a player (only a player). deathCount should be quite obvious (counts how much times you have died). And the last one is health. The health cryteria is different from the other cryteria's because it CANNOT be changed by any command blocks... it can only be changed by healing or hurting yourself.

  So now that we know how to add these different objective's let's learn how to actually see them visually. To do that we need to add an objective to a specific slot. There are currently 4 slots: "list", "sidebar" , "belowName", the last one is called "sidebar.team.color". The only one's you need to know for now is the first 3 slots. So know you are asking yourself "So how do I add the objective to a slot" well to do that just enter this command "/scoreboard objectives setdisplay (slotname) (objective name). There's one thing actually. If you create a new objective add instantly add it to the sidebar you won't see it until you modify the score.
  Okay so we have learned how to add an objective and add it to a specific slot. There are 2 last things that you need to learn about the objective's before we get to how to modify the score and then how to add teams. So the two things are that you will probably use in the future is "/scoreboard objectives remove (name)" and "/scoreboard objectives list" the first one removes an objective (quite obvious) and the second one show's ALL current added objectives.<br><br>"How do I modify the objective score?". This is what we will learn right now! The command for any kind of score modification is "/scoreboard players (add/remove/set/reset). There are a couple more but that's optional for now. To use the "add/remove/set" commands you will need to type this: "/scoreboard players add/remove/set (player name or @p,@r,@a) (objective name) (score number). So yeah the "add" will add score, the "remove" will remove score and the "set" will just set the score to then number you specify. The "reset" will just kinda reset the specified objective score for a specified player.

 
 So now let's learn the "/testfor" command. This is where the arguments come in... You can use the arguments for the scoreboard players command to specify which player you want to change the score for. So the command looks like this: "/testfor @p/@r/@a". The @p means "at player". The @r means "at random player". And the @a means "at all players". So yes now we know the basics for this command. Now let's start with the arguments. To add arguments to any kind of command that used @p/@r/@a just do: "@p/@r/@a[Arguments here]. The argument's can't contain any spaces. So now let's see what kind of arguments can we add, shall we? So the basic arguments are [score_objectivename=(score number)] this will just run the command on any player that has any kind of number from -(any number) to the number you specify. Then there is [score_objectivename_min=(score number)]. This runs the command on a player that has a minimum score of the specified score for the specified objective. Then there's [(x cordinates),(y cordinates),(z cordinates),(radius)] or [x=(x cordinates),y=(y cordinates),z=(z cordinates),r=(radius number)] this will run the command on a player that is in those cordinates. If you want the player to be in the EXACT place then the radius will be 0. If you want to run the command on a player that is somewhere around the cordinates that you specify then the radius will be higher. The argument that you absolutely need is [lm=(level)] and [l=(level)]. What this does is it runs the command on a player that has a specific level. As with the score the [l=(level)] will run the command on the maximum level and the "lm" will run on run on level minimum.


 This is it for today guys! To confirm that you have learned a lesson make a shop (requires a bit of comparator knowladge) that uses levels and a shop that useds the virtual objective score and then lemme know what you built! Gimme a diamond if you want to learn literally almost everything about command blocks. If I will ever finish the series you will learn to you use your knowladge to easily make anything possible in minecraft...



VKG147

More like this

  Have something to say?

chrisdude011
06/14/2015 11:37 am
Level 22 : Expert Pirate
Why does this not work
/execute @p {Inventory:[{Slot:103b,tag:{display:{Name:"SpaceHelmet"}}}]} ~ ~ ~ /scoreboard players set @p SpaceHelmet 1
it says
'{Inventory:[{Slot:103b,tag:{display:{Name:"SpaceHelmet"}}}]}' is not a valid number
1
chrisdude011
06/14/2015 11:44 am
Level 22 : Expert Pirate
Nevermid in figured it out
1

Welcome