Arqade Asked by Mews on December 7, 2020
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
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
Answered by Macks on December 7, 2020
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.
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.
Answered by ExpertCoder14 on December 7, 2020
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP