Command blocks work like commands in minecraft. When you right click a command block a typing bar appears. You can type commands in there except /kill and a few other exceptions. When a redstone signal is sent to the command block the command will be in effect. Some examples will be below.
say (what ever you want to have it say)
/gamemode (survival, creative, adventure)
/effect @a (effect #)
/(any command)
If its a command where you need your username after it just replace your username with @a or @p they both work.
@a can be replaced with the following.
@a : targets all players
@p : targets nearest player
@r : targets random player
Depends on who you want to target. Playing the map for only yourself? Use your username.
Releasing the map to the public? @p
Releasing the map to the public, but the situation requires all players? @a
Depends on who you want to target. Playing the map for only yourself? Use your username.
Releasing the map to the public? @p
Releasing the map to the public, but the situation requires all players? @a
Yea sorry, I meant to put that in the topic. Thanks for pointing it out for me. Have a nice day.
Putting say @a hi will say Bob and Bill hi. If it is say it will put an and between. You can also rename a command block with an anvil to change the [@]: When it says things.
Rollback Post to RevisionRollBack
"This sand is what's Left over from that. The rest of my sand became concrete and was transformed into that skyscraper. From the top, even a child can look down on any adult. A castle that blows away with the first gust of wind is worthless. Don't you agree, Nonon?" "But all buildings fall down eventually!" "Then you should build it inside your mind! A skyscraper built within your mind...will never fall down."
These are really only the basics, such as changing gamemode, difficulty, teleporting, clearing an inventory and giving potion effects and such. Even so is making a shop using experience shops.. But I guess for the people who are new to them:
Have a command block, then another ontop of that one. Have a repeater going into the one at the bottom, then a block with a button on it.
Giving Enchanted Items The player MUST be holding the item they are going to enchant. This means selecting the first FREE slot on their equipment bar.
Have the player hit a button.
Command Block One: /give @p 267
Gives the NEAREST PLAYER (@p) an IRON SWORD (267).
Command Block Two: /enchant @p 16 2
Enchants the item the nearest player is holding. In this case, it would give a sword Sharpness II enchantment.
To make sure the player CANNOT obtain ANOTHER enchanted item, have a piston cut off the curcuit by breaking a line of redstone.
Experience Shops You can change the item by using a different Item ID. Google search it.
Lower Command Block Command: /give @p[lm=5] 267
This will give the nearest player an IRON SWORD (267) for a MINIMUM (lm) of 5 EXPERIENCE LEVELS (=5)
Upper Command Block Command: /xp -5L @p[lm=5]
This will SUBTRACT5 EXPERIENCE LEVELS (-5L) from the nearest player, if that player has a MINIMUM (lm) of 5 EXPERIENCE LEVELS(=5)
Scoreboard This can be done as a regular command
Type /scoreboard objectives add Points totalKillCount Points
Next, type /scoreboard objectives setdisplay sidebar Points
Note: The words coloured in Purple can be whatever you wish them to be, just make sure they are the same.
Now, when you kill something, or someone, your kill count will show on a sidebar to the right side of the screen.
The argument "setdisplay" can be changed to any of the following:
list - Lists the players killcount in the (TAB) menu.
sidebar - Shows the players killcount on a scoreboard on the right side of the screen.
belowname - Lists the players killcount below their name label.
The argument "totalKillCount" can be changed to any of the following, depending on your purposes:
dummy - Score is only changed by commands, and not by game events such as death. This is useful for event flags, state mappings, and currencies.
deathCount - Counts the number of times a player has died.
playerKillCount - Counts how many PLAYER kills a player has obtained.
totalKillCount - Count the TOTAL number of kills a player has obtained.
health - Counts how much health a player has left.
Point Shops (Using points from the Scoreboard) Scoreboard must be in use for this to work!
This will give the CLOSEST PLAYER (@p) an IRON SWORD (267) if the player has a MINIMUM (score_Points_min) of 5 Points.
How to make doors that cost experience levels When making this, make sure you do not have any experience levels. Same goes for resetting the system.
Command Block One: /testfor @p[lm=5]
This will run a TEST (testfor) on the CLOSEST PLAYER (@p) to see if they have a MINIMUM LEVEL (lm) of 5EXPERIENCE LEVELS.
Behind this command block, place a redstone comparator. If the player tests positive (meaning the player has a minimum of 5 xp levels) the command block will output a signal to the comparator. MAKE SURE THE COMPARATOR IS NOT IN SUBTRACTION MODE.
Have this comparator facing another command block.
Command Block Two (with this comparator): /tp @p[lm=5] x y z
If the player tests positive to what we did earlier, the player will be teleported to our coordinates and active a pressure plate. That pressure plate will activate a signal and do the following:
/xp -5L @p[lm=5]
Player has 5 EXPERIENCE LEVELS TAKEN FROM THEM (-5L) if player has a MINIMUM OF 5 LEVELS (lm=5)
2. /say Door Opened!
Broadcasts a message across the map telling all players that a door has been opened.
3. /tp @p x y z
This will teleport the CLOSEST PLAYER (@p) to the coordinates of your choice.
Also, for the door, when the player teleports to the coordinates of the pressure plate, run a wire to an inverter to switch it off. This will deactivate a redstone torch, and make the pistons retract, releasing sand. This means the door has fallen, and is open. If you don't want to use sand, you can use an Iron door and wiring the pressure plate up to a T-Flip Flop, which will be wired up to the door.
Coming off the same line of redstone we were first using, make a new section.
Command Block One: /testfor @p[l=4]
This will run a TEST (testfor) to see if the player has a MAXIMUM (l) of 4 EXPERIENCE LEVELS. This means the player has 4 levels or LESS.
If the player tests positive to this test, he has tested negative to the other.
Now, to show the player he doesn't have enough xp, we will do the following:
Place down a redstone comparator branching off the command block, then place another command block in front of the comparator. Have it run this message:
/tell @p You do not have the required amount of funds to perform that action.
If this message appears, the player needs more XP to open the door.
The above can also be done with points from the scoreboard. Just change the @p[lm=5] to @p[score_Points_min] and the @p[l=4] to @p[score_Points=4]
Putting say @a hi will say Bob and Bill hi. If it is say it will put an and between. You can also rename a command block with an anvil to change the [@]: When it says things.
Thanks a lot i will use this in my maps.
Rollback Post to RevisionRollBack
Looking for decorative Minecrafters, email me at [email protected] to help out!
Experience Shops You can change the item by using a different Item ID. Google search it.
Lower Command Block Command: /give @p[lm=5] 267
This will give the nearest player an IRON SWORD (267) for a MINIMUM (lm) of 5 EXPERIENCE LEVELS (=5)
Upper Command Block Command: /xp -5L @p[lm=5]
This will SUBTRACT5 EXPERIENCE LEVELS (-5L) from the nearest player, if that player has a MINIMUM (lm) of 5 EXPERIENCE LEVELS(=5)
You can also make it only affect people on a certain space with @a[x=1,y=1,z=1,r=1]
This will only affect people in the same block as specified(in this example, 1,1,1) If you increase the r, you increase the space of effect.
If r=2 in the previous example, then it also affects the people standing in the 26 blocks around 1,1,1.
An example would be:
/give @a[x=1,y=1,z=1,r=2] 1 1
This command on a command block would give players on 1,1,1 and all directly and diagonally adjacent blocks 1 stone block.
Rollback Post to RevisionRollBack
Looking for decorative Minecrafters, email me at [email protected] to help out!
You can also make it only affect people on a certain space with @a[x=1,y=1,z=1,r=1]
This will only affect people in the same block as specified(in this example, 1,1,1) If you increase the r, you increase the space of effect.
If r=2 in the previous example, then it also affects the people standing in the 26 blocks around 1,1,1.
An example would be:
/give @a[x=1,y=1,z=1,r=2] 1 1
This command on a command block would give players on 1,1,1 and all directly and diagonally adjacent blocks 1 stone block.
I made this post a while back. In my thread, everything is much more defined. ^.^
Is there any sort of way to target a player within a certain area and radius ( such as @a[x,y,z,r]) who does not have a certain item in their inventory? For example, any player within the radius who does not have a diamond in their inventory is given a wither effect. Is that possible?
say (what ever you want to have it say)
/gamemode (survival, creative, adventure)
/effect @a (effect #)
/(any command)
If its a command where you need your username after it just replace your username with @a or @p they both work.
@a can be replaced with the following.
@a : targets all players
@p : targets nearest player
@r : targets random player
Releasing the map to the public? @p
Releasing the map to the public, but the situation requires all players? @a
"But all buildings fall down eventually!"
"Then you should build it inside your mind! A skyscraper built within your mind...will never fall down."
Have a command block, then another ontop of that one. Have a repeater going into the one at the bottom, then a block with a button on it.
Giving Enchanted Items
The player MUST be holding the item they are going to enchant. This means selecting the first FREE slot on their equipment bar.
Have the player hit a button.
Command Block One: /give @p 267
Gives the NEAREST PLAYER (@p) an IRON SWORD (267).
Command Block Two: /enchant @p 16 2
Enchants the item the nearest player is holding. In this case, it would give a sword Sharpness II enchantment.
To make sure the player CANNOT obtain ANOTHER enchanted item, have a piston cut off the curcuit by breaking a line of redstone.
More on enchantments can be found here on the Minecraft Wiki!
Experience Shops
You can change the item by using a different Item ID. Google search it.
Lower Command Block Command: /give @p[lm=5] 267
This will give the nearest player an IRON SWORD (267) for a MINIMUM (lm) of 5 EXPERIENCE LEVELS (=5)
Upper Command Block Command: /xp -5L @p[lm=5]
This will SUBTRACT 5 EXPERIENCE LEVELS (-5L) from the nearest player, if that player has a MINIMUM (lm) of 5 EXPERIENCE LEVELS (=5)
Scoreboard
This can be done as a regular command
Type /scoreboard objectives add Points totalKillCount Points
Next, type /scoreboard objectives setdisplay sidebar Points
Note: The words coloured in Purple can be whatever you wish them to be, just make sure they are the same.
Now, when you kill something, or someone, your kill count will show on a sidebar to the right side of the screen.
The argument "setdisplay" can be changed to any of the following:
list - Lists the players killcount in the (TAB) menu.
sidebar - Shows the players killcount on a scoreboard on the right side of the screen.
belowname - Lists the players killcount below their name label.
The argument "totalKillCount" can be changed to any of the following, depending on your purposes:
dummy - Score is only changed by commands, and not by game events such as death. This is useful for event flags, state mappings, and currencies.
deathCount - Counts the number of times a player has died.
playerKillCount - Counts how many PLAYER kills a player has obtained.
totalKillCount - Count the TOTAL number of kills a player has obtained.
health - Counts how much health a player has left.
Point Shops (Using points from the Scoreboard)
Scoreboard must be in use for this to work!
Lower Command Block Command: /scoreboard players remove @p[score_Points_min=5] Points 5
This will SUBTRACT 5 POINTS (remove Points 5) from the CLOSEST PLAYER (@p) if the player has a MINIMUM (score_Points_min) of 5 Points.
Upper Command Block Command: /give @p[score_Points_min=5] 267
This will give the CLOSEST PLAYER (@p) an IRON SWORD (267) if the player has a MINIMUM (score_Points_min) of 5 Points.
How to make doors that cost experience levels
When making this, make sure you do not have any experience levels. Same goes for resetting the system.
Command Block One: /testfor @p[lm=5]
This will run a TEST (testfor) on the CLOSEST PLAYER (@p) to see if they have a MINIMUM LEVEL (lm) of 5 EXPERIENCE LEVELS.
Behind this command block, place a redstone comparator. If the player tests positive (meaning the player has a minimum of 5 xp levels) the command block will output a signal to the comparator. MAKE SURE THE COMPARATOR IS NOT IN SUBTRACTION MODE.
Have this comparator facing another command block.
Command Block Two (with this comparator): /tp @p[lm=5] x y z
If the player tests positive to what we did earlier, the player will be teleported to our coordinates and active a pressure plate. That pressure plate will activate a signal and do the following:
2. /say Door Opened!
Broadcasts a message across the map telling all players that a door has been opened.
3. /tp @p x y z
This will teleport the CLOSEST PLAYER (@p) to the coordinates of your choice.
Also, for the door, when the player teleports to the coordinates of the pressure plate, run a wire to an inverter to switch it off. This will deactivate a redstone torch, and make the pistons retract, releasing sand. This means the door has fallen, and is open. If you don't want to use sand, you can use an Iron door and wiring the pressure plate up to a T-Flip Flop, which will be wired up to the door.
Coming off the same line of redstone we were first using, make a new section.
Command Block One: /testfor @p[l=4]
This will run a TEST (testfor) to see if the player has a MAXIMUM (l) of 4 EXPERIENCE LEVELS. This means the player has 4 levels or LESS.
If the player tests positive to this test, he has tested negative to the other.
Now, to show the player he doesn't have enough xp, we will do the following:
Place down a redstone comparator branching off the command block, then place another command block in front of the comparator. Have it run this message:
/tell @p You do not have the required amount of funds to perform that action.
If this message appears, the player needs more XP to open the door.
The above can also be done with points from the scoreboard. Just change the @p[lm=5] to @p[score_Points_min] and the @p[l=4] to @p[score_Points=4]
For more information, visit the Minecraft Wiki!
(Command Block Tutorials Section and Command Block Section)
I really hope I have helped. If you need anything else, send me a PM!
~Feare_104
http://www.minecraftforum.net/topic/1762639-simple-command-block-tutorials/
~Feare_104
Thanks a lot i will use this in my maps.
You can also make it only affect people on a certain space with @a[x=1,y=1,z=1,r=1]
This will only affect people in the same block as specified(in this example, 1,1,1) If you increase the r, you increase the space of effect.
If r=2 in the previous example, then it also affects the people standing in the 26 blocks around 1,1,1.
An example would be:
/give @a[x=1,y=1,z=1,r=2] 1 1
This command on a command block would give players on 1,1,1 and all directly and diagonally adjacent blocks 1 stone block.
I made this post a while back. In my thread, everything is much more defined. ^.^
~Feare_104