Article Categories
- Baldur's Gate 3
- Diablo
- Elder Scrolls
- General
- Hogwarts Legacy
- League of Legends
- Minecraft
- Pokemon Go
- Sims 4
- StarCraft
- Steam Platform
- Xbox Game Console
More Articles
Can scoreboards detect if a player is killed with a specific item?
I'm making a sword that will gain attack damage every time a player gets a kill with it. I think I can get the sword attributes to change based on a scoreboard, but I don't know if I can make a scoreboard that detects if a player is killed by someone using the sword. Does anyone know if this is possible, and if so, how would I do it?
Question from user VeryHotClara at gaming.stackexchange.com.
Answer:
Give yourself an item, for example a sword, include this nbt:.
{customid:"leveling_sword",AttributeModifiers:[{AttributeName:"generic.attack_damage",Name:"generic.attack_damage",Amount:1,Operation:0,UUID:[I;1634486241,408504796,-1808684184,1791120101],Slot:"mainhand"}]}.
It doesn't matter what the UUID is because we will use a custom NBT tag.
Setup commands (run once):.
`/scoreboard objectives add kill playerKillCount kill```\.
For the looped commands you either put them in this order using 1 repeating and multiple chain command blocks, or just use a function in a datapack.
Looped commands:.
/execute as @a[scores={kill=1..},nbt={SelectedItem:{customid:"leveling_sword"}}] run
/scoreboard players set @a kill 0.
For the part I'm not sure on the exact stuff to do. I know 2 options but I don't have time rn so imma just post this and someone else might have a better idea.
Option one is to replace the first command with /item:.
item modify @a[scores={kill=1..},nbt={SelectedItem:{customid:"leveling_sword"}}]
https://minecraft.wiki/w/Item_modifier.
Option two is to use /data using NBT path format which doesn't require a datapack. However you can't use /data on a player so you first have to move the item to another entity like an armor stand. You might need one armor stand per player in case there are 2 kills on the same game tick. A possibility is to put a marker armor stand on each player's head using /ride.
Answer from user Samstercraft at gaming.stackexchange.com.
I'm making a sword that will gain attack damage every time a player gets a kill with it. I think I can get the sword attributes to change based on a scoreboard, but I don't know if I can make a scoreboard that detects if a player is killed by someone using the sword. Does anyone know if this is possible, and if so, how would I do it?
Question from user VeryHotClara at gaming.stackexchange.com.
Answer:
Give yourself an item, for example a sword, include this nbt:.
{customid:"leveling_sword",AttributeModifiers:[{AttributeName:"generic.attack_damage",Name:"generic.attack_damage",Amount:1,Operation:0,UUID:[I;1634486241,408504796,-1808684184,1791120101],Slot:"mainhand"}]}.
It doesn't matter what the UUID is because we will use a custom NBT tag.
Setup commands (run once):.
`/scoreboard objectives add kill playerKillCount kill```\.
For the looped commands you either put them in this order using 1 repeating and multiple chain command blocks, or just use a function in a datapack.
Looped commands:.
/execute as @a[scores={kill=1..},nbt={SelectedItem:{customid:"leveling_sword"}}] run
/scoreboard players set @a kill 0.
For the part I'm not sure on the exact stuff to do. I know 2 options but I don't have time rn so imma just post this and someone else might have a better idea.
Option one is to replace the first command with /item:.
item modify @a[scores={kill=1..},nbt={SelectedItem:{customid:"leveling_sword"}}]
https://minecraft.wiki/w/Item_modifier.
Option two is to use /data using NBT path format which doesn't require a datapack. However you can't use /data on a player so you first have to move the item to another entity like an armor stand. You might need one armor stand per player in case there are 2 kills on the same game tick. A possibility is to put a marker armor stand on each player's head using /ride.
Answer from user Samstercraft at gaming.stackexchange.com.
Whats wrong with this custom blocks loot table? Its supposed to choose drop by testing for silk touch, but non-enchanted pick drops both options
Dwarves keep dumping seeds in a corner?
How can I install Diablo 3 if I use FileVault?
What are all the ways to impact your trial grade in Outlast Trials?
What determines Ranalds Gift in Warhammer Vermintide 2?
First time playing Hogwarts Legacy
How do you target a new player with a command on Minecraft 1.19.3?
So is leap of faith just impossible now?
Can scoreboards detect if a player is killed with a specific item?
What games are similar to Hogwarts Legacy?


