Minecraft - Giving one level of experience for every mob that is killed
I am currently building a minigame in 1.12 with only command blocks. I need to know how to give a player 1L of experience for every zombie that they kill. For instance, when a person kills one zombie, I want them to get 1 level. When they kill a second one, get one more level (Now they have two levels), and so on.
Does anyone have any command block solutions for this?
11 Answer
For the XP part:
You can use the /xp command. The format for the command (on PC / MAC) looks like this:
/xp add <targets> <amount> [levels¦points]You can also get the amount the player has:
/xp query <targets> <levels¦points>And lastly, you can just set the level of XP:
/xp set <targets> <amount> [levels¦points]Also, it's worth notin that to add specific points, you would do something like this:
/xp <amount> [player]But to add levels, which is what you're wanting to do, you would do something like this:
/xp <amount>L [player]Hope this helped, although I couldn't find a way for zombies to drop XP when they die without modding. You could potentially use a pressure plate (in a one block cell) and when the pressure plate isn't down you can give a certain level of XP with a command block. Not ideal, but it would work. Hope you find a better way to do this!
EDIT:
I'm assuming you're familiar with Command Blocks, but for reference, you would remove the '/' part of the command, and replace the targets with something like @p or @a depending on what you want to do