I am working on a new map on Minecraft and I was wondering if anyone knew how to testfor XP gain. For example if I gained 10 levels it would output a signal, and if I gain another 10 levels, it would output another signal. Does anyone know how to do this?

  • 1
    Have you made any attempt to solve this yourself? Arqade works better when askers show effort to solve their own problems; we see that you have a problem you've worked on, and answerers respond to that. You also get a more specific answer that's tailored exactly to the part you're stuck, and Arqade gets a very specific question. Everybody wins! – Frank Feb 8 '17 at 23:13

You can use the selector l, lm to test for experience levels. l means maximum experience level, lm means minimum.

To test for a player with at least 10 levels of experience:

/testfor @a[lm=10]

If you only want the testfor to succeed once for each player, add a tag to the player:

/scoreboard players tag @a[lm=10] add xp10

And change the command to:

/testfor @a[lm=10,tag=!xp10]
|improve this answer|||||

Maybe you need scoreboard, the level criteria. Record the previous level, compare it with the current level. If a-b is larger or equal to 10, then output signal, and set the score to the current level.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.