1

I want to give players swiftness when they reach level 10. Then when they get to 20 they get another effect then 30 and 40 and so on I just don’t know how to do it.

  • In MCJava at least there's a target selector for XP levels. – Fabian Röling May 22 at 8:54
0

Basics

Place a repeating command block and set it to Always Active. In the command input, type:

/effect @a[lm=10,l=20] speed 1

This will effect all players with a status effect between 10 and 20 levels with speed.

Repeat but change the lm and l numbers to set the level where the effect is applied. lm is the minimum amount needed to trigger, l is the maximum.

Things You Can Change

Change the 2nd number after speed to change the effect's level. Note that it is a 0-based index, so for level 1 you type 0, for level 2 you type 1, and so on. Example:

/effect @a[lm=10,l=20] speed 1 1

to give the players speed II.

If you don't want the particles to show up simply add true to the end of the command:

/effect @a[lm=10,l=20] speed 1 0 true

How it Works

The @a[lm=10,l=20] is the part that does the magic. That is where you select who you want the effect to be applied to. The @a selects all online players, and the part in []s lets you narrow down your search.

[l=20] sets the maximum amount to target. [lm=10] sets the minimum. This means that anyone with a minimum of 10 levels and a maximum of 20 levels will be targeted.

The command only gives the effect for one second. But because the command block repeats every 20 times a second, it will keep giving the effect preventing it from running out.


If you want the effect to only be applied once for a certain time, it will be a bit harder. Please comment below if you would like that.

| improve this answer | |
  • Note that if you want it to be one level, set the l and lm selectors to the same thing. – Penguin Oct 20 at 21:22

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.