New to the forum and very new to command blocks. I have started making a pvp arena map and have programmed a long chain of commands that creates two teams, divides players randomly, gives all players food/weapons etc.
I want to add a feature that rewards a players with a head when they kill another player. I have already set up an objective in the scoreboard and made the kill count appear in the sidebar, but I can't seem to get the code for kill rewards right.
I have put the following code into a purple commandblock: give @a[scores={amount=3}] minecraft:player_head 1
Can someone enlighten me why this doesn't work?
ps. I have googled a lot and tried various codes, but neither seem to work. I haven't been able to test it on another player but I figured it would work when I set my own killscore to 3 with a command....
then have a chain command block set to always active
kill @e[name="(redstone block or lapis block)"]
example
kill @e[name="redstone block"]
set up a different command block line with a repeating command block set to always active with
/execute if entity @a[scores={Kills=3}] run give @a[scores={Kills=3}] minecraft:cake 1 (this is to make sure that only players who have a kill score of 3 will get cake)
and follow it up with a chain command attached to it set to always active and conditional
scoreboard players add Kills 1 (this only runs IF the last one was successful, so if no players have a kill of 3 and don't get cake then this wont happen it also makes it so you can make another one of these checking for something like 5 kills for another reward)
Now I'm guessing your displaying kills which could be a problem. Though I don't know if you are or not. If your not (which I wouldn't because of issues with scoreboard displays) then all this should work fine. If you are displaying kills Ill check back on this post and see if I can work something out.
I'm not sure this is exactly what I'm after, though. I want a reward after every kill. There are supposed to be two teams with three players in each team and whenever someone kills a player of the opposing team the kill score goes up and they get a head (or a cake, haven't decided yet).
Here is my command chain for the teams and the kill count:
Create teams: team add Yellow, (+team add Purple)
Divide players: team join Yellow @r[limit=3,sort=random], (+team join Purple @r[limit=3,sort=random])
are you you are playing bedrock? There's no /team command. I just realized this isn't for bedrock and I'm an idiot.
see I'm not use to minecraft java its been a hot second seance I've done anything java. you should be able to add a team tag to your commands so its
/execute if entity @a[scores={Kills=3},team=yellow] run give @a[scores={Kills=3}] minecraft:skull 1 (the team tag I'm not so sure on so just start punching it in chat and seeing what the auto complete thing says)
to run though everything you set up a scoreboard that keeps track of kills. you set up a command block
So I've been trying for a wile now to figure out how to get this to do what you want it to do and I can't quite seem to do it.
Would you be willing to send me a copy of the world so I can look over your work and familiarize myself with it. I tried just copying what you did and found an issue with your commands about joining teams
i found that the game would assign 3 players to be on yellow then three players to be on purple. the problem is it does this at random so it has a vary good chance of grabbing players who are on yellow to be on purple right after.
I so unfamiliar with minecraft java commands now that this is kinda hard to do so I would like to review your work with my own eyes and mess with it and do some trial an error until I find out how to get it to do exactly what you want.
So I've been trying for a wile now to figure out how to get this to do what you want it to do and I can't quite seem to do it.
Would you be willing to send me a copy of the world so I can look over your work and familiarize myself with it. I tried just copying what you did and found an issue with your commands about joining teams
i found that the game would assign 3 players to be on yellow then three players to be on purple. the problem is it does this at random so it has a vary good chance of grabbing players who are on yellow to be on purple right after.
I so unfamiliar with minecraft java commands now that this is kinda hard to do so I would like to review your work with my own eyes and mess with it and do some trial an error until I find out how to get it to do exactly what you want.
Yeah, you're probably right that there will be an error upon team joining. I haven't been able to test it out yet with more players than me. I don't really know how to get it right though. This is soo hard!
Thanks for your engagement in my problem! Unfortunately, I'm doing this on a realm that a friend has so I don't think I have access to the world in that way.. Or do I?
give @a iron_sword{display:{Name:"\"Excalibur\"",Lore:["\"Wield with Responsibility!\""]},Enchantments:[{id:knockback,lvl:2},{id:unbreaking,lvl:1}]} 1
give @a minecraft:snowball 64
give @a minecraft:apple 64
gamemode survival @a
gamerule naturalRegeneration false
spawnpoint @a -139 133 1720
gamerule doMobSpawning false
/title @a title {"text":"GAME IS ON!", "bold":true, "italic":true, "color":"red"}
/title @a subtitle {"text":"This is killing!!!", "italic":true, "color":"yellow"}
so I guess another way of getting the team joining work is to sort out one person at a time based on radius from command block? Say I teleport all players to a room and from there, one person at the time gets teleported to the starting platform.
Hello!
New to the forum and very new to command blocks. I have started making a pvp arena map and have programmed a long chain of commands that creates two teams, divides players randomly, gives all players food/weapons etc.
I want to add a feature that rewards a players with a head when they kill another player. I have already set up an objective in the scoreboard and made the kill count appear in the sidebar, but I can't seem to get the code for kill rewards right.
I have put the following code into a purple commandblock: give @a[scores={amount=3}] minecraft:player_head 1
Can someone enlighten me why this doesn't work?
ps. I have googled a lot and tried various codes, but neither seem to work. I haven't been able to test it on another player but I figured it would work when I set my own killscore to 3 with a command....
I kind of got this to work, but when I set the block to repeat it obviously spams my inventory with cakes. It also gives all players a cake:
/execute if entity @a[scores={Kills=1..}] run give @a minecraft:cake 1
Can I perhaps modify this to trigger once upon a change in score?
what command are you using to determine if a player is killed?
or is that what your tying to figure out?
I figured out what you need.
give each team an item special to that team. I made a team pvp CTF map and did this.
for my red team I used a redstone block
the blue team got a lapis block
after that get a repeating command block in a chunk were it will always be active when players are in the arena set to always active with the command
execute @e[name="(eather laips block or redstone block)"] ~ ~ ~ kill @e[name="(repeat the name)"]
example
execute @e[name="redstone block"] ~ ~ ~ scoreboard players add @p Kills 1
then have a chain command block set to always active
kill @e[name="(redstone block or lapis block)"]
example
kill @e[name="redstone block"]
set up a different command block line with a repeating command block set to always active with
/execute if entity @a[scores={Kills=3}] run give @a[scores={Kills=3}] minecraft:cake 1 (this is to make sure that only players who have a kill score of 3 will get cake)
and follow it up with a chain command attached to it set to always active and conditional
scoreboard players add Kills 1 (this only runs IF the last one was successful, so if no players have a kill of 3 and don't get cake then this wont happen it also makes it so you can make another one of these checking for something like 5 kills for another reward)
Now I'm guessing your displaying kills which could be a problem. Though I don't know if you are or not. If your not (which I wouldn't because of issues with scoreboard displays) then all this should work fine. If you are displaying kills Ill check back on this post and see if I can work something out.
Hello and thank you for this answer!
I'm not sure this is exactly what I'm after, though. I want a reward after every kill. There are supposed to be two teams with three players in each team and whenever someone kills a player of the opposing team the kill score goes up and they get a head (or a cake, haven't decided yet).
Here is my command chain for the teams and the kill count:
Create teams: team add Yellow, (+team add Purple)
Divide players: team join Yellow @r[limit=3,sort=random], (+team join Purple @r[limit=3,sort=random])
Create kill count objective: scoreboard objectives add Kills playerKillCount
Display kill Count: scoreboard objectives setdisplay sidebar Kills
I also have two commands that creates a health meter.
The question is: How do I create a code that scans for changes in kill count and rewards that player with 1 head?
are you you are playing bedrock? There's no /team command. I just realized this isn't for bedrock and I'm an idiot.
see I'm not use to minecraft java its been a hot second seance I've done anything java. you should be able to add a team tag to your commands so its
/execute if entity @a[scores={Kills=3},team=yellow] run give @a[scores={Kills=3}] minecraft:skull 1 (the team tag I'm not so sure on so just start punching it in chat and seeing what the auto complete thing says)
to run though everything you set up a scoreboard that keeps track of kills. you set up a command block
So I've been trying for a wile now to figure out how to get this to do what you want it to do and I can't quite seem to do it.
Would you be willing to send me a copy of the world so I can look over your work and familiarize myself with it. I tried just copying what you did and found an issue with your commands about joining teams
i found that the game would assign 3 players to be on yellow then three players to be on purple. the problem is it does this at random so it has a vary good chance of grabbing players who are on yellow to be on purple right after.
I so unfamiliar with minecraft java commands now that this is kinda hard to do so I would like to review your work with my own eyes and mess with it and do some trial an error until I find out how to get it to do exactly what you want.
Yeah, you're probably right that there will be an error upon team joining. I haven't been able to test it out yet with more players than me. I don't really know how to get it right though. This is soo hard!
Thanks for your engagement in my problem! Unfortunately, I'm doing this on a realm that a friend has so I don't think I have access to the world in that way.. Or do I?
And Yeah, I'm on java edition.
This is my current chain:
say Game is Starting
team add Purple
team add Yellow
team join Purple @r[limit=3,sort=random]
team join Yellow @r[limit=3,sort=random]
scoreboard objectives add Kills playerKillCount
scoreboard objectives setdisplay sidebar Kills
team modify Purple color dark_purple
team modify Yellow color yellow
scoreboard objectives add Hearts health
scoreboard objectives setdisplay list Health
time set night
tp @a[team=Purple] -139 118 1759 facing -139 115 1720
tp @a[team=Yellow] -139 118 1681 facing -139 115 1720
clear @a
give @a iron_sword{display:{Name:"\"Excalibur\"",Lore:["\"Wield with Responsibility!\""]},Enchantments:[{id:knockback,lvl:2},{id:unbreaking,lvl:1}]} 1
give @a minecraft:snowball 64
give @a minecraft:apple 64
gamemode survival @a
gamerule naturalRegeneration false
spawnpoint @a -139 133 1720
gamerule doMobSpawning false
/title @a title {"text":"GAME IS ON!", "bold":true, "italic":true, "color":"red"}
/title @a subtitle {"text":"This is killing!!!", "italic":true, "color":"yellow"}
so I guess another way of getting the team joining work is to sort out one person at a time based on radius from command block? Say I teleport all players to a room and from there, one person at the time gets teleported to the starting platform.
Wrong forum for the java edition. If you remove this post and repost in the java forum, you might get an answer.
Link: https://www.minecraftforum.net/forums/minecraft-java-edition/redstone-discussion-and/commands-command-blocks-and