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]

Whats the most efficient brain–computer interface to play video games? Whats the most efficient brain–computer interface to play video games?

Posted On: March 29, 2024
I read:.Technology for connecting paralyzed folks with computers has existed for a while now, according to Bloomberg:.Neuralink is not the only company working on brain devices that connect with comp...[More]


Attempting my first honor mode run Attempting my first honor mode run

Posted On: September 10, 2024
I've beat the game twice on balanced with different party combos and classes to familiarize myself with as much as the game as possible. .My plan for my HM run is:.Spores Druid Tav, OH Monk Karlach (m...[More]


How did GeorgeNotFound use water on leaves without waterlogging it? How did GeorgeNotFound use water on leaves without waterlogging it?

Posted On: January 15, 2023
You know, placing water on leaves will make them waterlogged. But how GeorgeNotFound placed water on a tree in Minecraft death swap video without waterlogging it? Is it possible? If yes, how? I'...[More]


Dead or Alive: Dimensions Control Mechanism Dead or Alive: Dimensions Control Mechanism

Posted On: March 24, 2023
In the recently released title for the Nintendo 3DS, some of the video previews seem to suggest that the characters are controlled by "selecting" combinations on the touch screen, rather tha...[More]


Can I change my house later in the game? Can I change my house later in the game?

Posted On: July 19, 2023
Once I've chosen my house, is it possible to change my house to a different house later in the game or do I need to start a new game? Like let's say I've chosen Slytherin as my starting...[More]


Is there an easier way to fuse materials to a melee weapon in ToTK? Is there an easier way to fuse materials to a melee weapon in ToTK?

Posted On: May 15, 2023
When shooting an arrow, there's a single-button prompt to fuse a material from your inventory to the arrow. However, so far, the only way I've found to fuse a material (monster horn, etc) to y...[More]


How to get the Operating Profit Graph for the entire game? How to get the Operating Profit Graph for the entire game?

Posted On: September 6, 2023
The game shows it only for last few years:. Is it possible to get similar graph for the entire game duration? Question from user ZakiMa at stackexchange. Answer: It's not possible. The...[More]


Effective ways to apply Weakness as a Hunter Effective ways to apply Weakness as a Hunter

Posted On: June 16, 2023
With the new Void sub-class changes Bungie are rolling out new bounties around the void status effects. Such as this one. Defeat combatants in Vanguard playlists by weakening them with Void. ...[More]


Kagha arrange for Halsin's imprisonment? What was her plan? Kagha arrange for Halsin's imprisonment? What was her plan?

Posted On: December 29, 2024
[Spoilers].I figure she didn't, that she was already being seduced by the dark side of the Force, sorry wrong franchise, already being manipulated by the Shadow Druids, and when Halsin disappeared loo...[More]


Is it possible to beat Infinity Blade on the first bloodline? Is it possible to beat Infinity Blade on the first bloodline?

Posted On: September 22, 2023
I've played through two bloodlines so far in Infinity Blade. Both times I made it to the boss, and both times he beat me. I imagine it's possible to beat him after leveling up over the course ...[More]