Can scoreboards detect if a player is killed with a specific item?

[BACK]
Can scoreboards detect if a player is killed with a specific item?
Posted On: March 14, 2024

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"}}] where points to a json file in a loaded datapack.


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.


[BACK]
Can scoreboards detect if a player is killed with a specific item?
Posted On: March 14, 2024

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"}}] where points to a json file in a loaded datapack.


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.


[BACK]

How can I set up a proper turn-based ambush in BG3? How can I set up a proper turn-based ambush in BG3?

Posted On: March 3, 2024
When my party encounters a group of unaware enemies, I want to sneak up.on the enemies, get everyone into position, then attack together. How.do I do that?My naive approach so far is:.Before initiati...[More]


Floo Flames in Hogwarts Legacy Floo Flames in Hogwarts Legacy

Posted On: March 24, 2023
LoL anybody else in here make it a point to visit every last floo flame on the map shortly after u got ur broom? I'm like 16 hours into the game and barely %25 done with the game  Question...[More]


Where can I check spell hunger for my Dungeon Crawl spells? Where can I check spell hunger for my Dungeon Crawl spells?

Posted On: May 8, 2023
Where, in game, can I check how much hunger each of my spells will cost me? I know I can check my morgue file by dumping with # but that's tedious. (Note that this applies to versions prior ...[More]


Why does my PS5 change the screen size sometimes? Why does my PS5 change the screen size sometimes?

Posted On: March 5, 2024
Occasionally when I turn on my PS5 by pressing the controller PS button, the console will not use the full screen size of my TV.Sometimes it's the correct size, let's call that 100%.Sometimes it's sma...[More]


Can you get duplicate standees from the Poplin Shop? Can you get duplicate standees from the Poplin Shop?

Posted On: November 5, 2023
When I buy a Standee Surprise from the Poplin Shop it gives me a random Standee. Is it possible to get a duplicate Standee I already have? Question from user Stevoisiak at stackexchange. Answer:...[More]


Why cant I see the special world types in Minecraft even though I am pressing shift? Why cant I see the special world types in Minecraft even though I am pressing shift?

Posted On: June 23, 2023
I want to try to play special kind of worlds (like Floating Island and Debug), and I remember that in order to do that, you need to press shift while clicking on the World Type button on the Create Ne...[More]


I need help naming my Durge I need help naming my Durge

Posted On: December 21, 2024
I’m open to any suggestions y’all may have.Question from user AlarmingAd3090 at BaldursGate3 at reddit.com.Answer:Jennerica Inkhorn.Answer from user No-Bad-463 at BaldursGate3 at reddit.com....[More]


What are the in-app purchases for Layton and the Diabolical Box on Android? What are the in-app purchases for Layton and the Diabolical Box on Android?

Posted On: March 19, 2023
The Google Play store page for Professor Layton and the Diabolical Box on Android says it contains in-app purchases. I can't find any other mention of them on the store page. What are the in-ap...[More]


This happened when giving Karlach a soul coin in Act 3 This happened when giving Karlach a soul coin in Act 3

Posted On: November 13, 2025
I recently posted about a scene that happens if you have Karlach consume a soul coin after transforming into an Illithid. It was requested I provide a video, so after far too much frustration to get t...[More]


What does saying X mean in the faction chat in Albion Online? What does saying X mean in the faction chat in Albion Online?

Posted On: May 16, 2023
I see many people "x" in the chat, but I cannot find a clear answer to what it means. Asking in the chat also does not give me any answers. Question from user TheBird956 at gaming.stackex...[More]