0

What I mean by the title is, for example, say I have a dummy type scoreboard with the value of 4 for me. How would I, say, effect myself speed level 'the value in the scoreboard', or give myself an enchanted sword with the sharpness level of the scoreboard's value... stuff like that.

Note: I am using 1.8

1

1.12−

The thing is, although there should be a simple answer for this, there isn't. I haven't been able to find a way to do this, except for doing one check per level, for example, running the following...

/give @p[score_dummy=4,score_dummy_min=4] diamond_sword 1 0 {ench:[{id:16,lvl:1}]}

...rinse and repeat for each level!

This can get very repetitive, especially in older versions, which aren't that good at converting between NBT and scoreboard values.

1.13+

I have a simple solution using clever modification of the /execute command!

Run the following two commands in order:

/give @p diamond_sword{Enchantments:[{id:"minecraft:sharpness",lvl:1s}]}
/execute store result entity @p Inventory[{id:"minecraft:diamond_sword"}].tag.Enchantments[{id:"minecraft:sharpness"}].lvl short 1.0 run scoreboard players get @p dummy

This command will give the player a diamond sword, and then modify it to the correct level of Sharpness.

1

A way you can do this is having command blocks for each scoreboard level, such as

/give @a[score_dummy_min=1,score_dummy=1] minecraft:diamond_sword 1 0 {ench:[{id:16,lvl:1}]}

/give @a[score_dummy_min=1,score_dummy=2] minecraft:diamond_sword 1 0 {ench:[{id:16,lvl:2}]}

and so on, as there is no way to use scoreboard values as variables in vanilla

1
  • You're right, I forgot, I'll change it now
    – Authom
    Sep 7 '20 at 23:30

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.