For having command block-driven attacks do certain amounts of damage, our traditional methods are kind of weak. We can give the instant damage effect, but that’s in multiples of 4, and doesn’t work for undead. There’s not an easy way to do a single point of damage, especially if armor is worn. The damage command would be formatted like this:
The deathnote parameter is optional, and if left out, the targets death message (if shown) will be “was killed by magic.”
Example: Having the command “/damage @r 2” will do two damage to a random player- if they die their death message will be “MCPlayer111 was killed by magic”.
Example: If a command block had the command “/damage @r 2 “was killed by a falling meteor!””, a random player would take one heart of damage, and if they die, their death message would be “MCPlayer111 was killed by a falling meteor!”.
If a command block executes it from a player or a player runs the command themselves, they will take credit for the kill in stats (killedBy and playerKillCount), and can also have their name be in the death message. “/damage @r 8 “was killed by “,@s,”’s Meteor!” (Or JSON formatting, which would make a lot more sense, I just won’t type it out :) ) run from a player would make the target’s death message “MCPlayer111 was killed by CommandExpertz’s Meteor!”
Essentially, it’s easy to use, and beneficial to the command community!
Please sign in to leave a comment.