The Meaning of Life, the Universe, and Everything.
Join Date:
8/31/2012
Posts:
46
Member Details
Hope my title wasn't too much of a word salad.
Anyway, this is what I'm trying to do. Say a player has iron_helmet and it's equipped on their head. I have a command block that will test for that and give them the potion effect I'd like them to have (say, for example, Regeneration I). Works perfectly fine. Now, say that same player has iron_chestplate equipped. I'd like for that player to now have Regeneration II. Iron_leggings yield Regeneration III. Etc. And, of course, if they now only have 2 iron armor pieces equipped, now they go down to Regeneration II, and so forth.
I'm not sure how to do math utilizing /scoreboard. Any help, please? I've been using /scoreboard players tag up to now. I suspect I need to use a dummy objective, but am not sure how to make it work right.
Also...it's looking like I could use a really good "course" on /scoreboard, since a lot of the web pages I've found are kind of terse...and I have the feeling it's probably something I'll be making use of a *lot* in the near future.
So, any help on my "math" problem, and on a good /scoreboard learning source, would be a big help.
Thanks!
Oh. I should say I'm using Minecraft 1.12.2 right now.
The Meaning of Life, the Universe, and Everything.
Join Date:
8/31/2012
Posts:
46
Member Details
Thanks for the replies!
I guess I probably did a poor job of explaining what I need (obviously). I figured using the item name (i.e. "minecraft:iron_boots) would be a good enough example. But let's say I have added an arbitrary tag (i.e., "REGEN:1b") to certain items. I'm trying to get an effect (or, even, cumulative effects in this case) if a player is wearing *any* armor item, they get (for example) regeneration 1...2 armor items, regen 2, etc.
Sorry about not being very clear. Though, the above info does help. I may have to do a separate command block for each particular tier of armor (leather/iron/diamond/etc). I was hoping for something a little more compact.
Thanks!
PS: I actually have that wiki link bookmarked. I think I need something with more detail to it. Thanks!
The Meaning of Life, the Universe, and Everything.
Join Date:
8/31/2012
Posts:
46
Member Details
Oh crap.
Well, the regeneration potion effect doesn't seem to work when those commands are put into command blocks. Things like JUMP_BOOST (and others) do, but not this one. The little hearts dance around, but empty hearts don't refill...until I take the armor *off*. Then as the REGEN buff timer counts down, the potion effect works.
The Meaning of Life, the Universe, and Everything.
Join Date:
8/31/2012
Posts:
46
Member Details
a...*scoreboard* timer? You mean, outside of having a command block do the occasional scoreboard objective checking?
Huh. No idea how to do that. Hopefully I can find a good tutorial. I've seen lots of ways of making clocks with redstone and hoppers... I'll have to see what I can dredge up.
Hope my title wasn't too much of a word salad.
Anyway, this is what I'm trying to do. Say a player has iron_helmet and it's equipped on their head. I have a command block that will test for that and give them the potion effect I'd like them to have (say, for example, Regeneration I). Works perfectly fine. Now, say that same player has iron_chestplate equipped. I'd like for that player to now have Regeneration II. Iron_leggings yield Regeneration III. Etc. And, of course, if they now only have 2 iron armor pieces equipped, now they go down to Regeneration II, and so forth.
I'm not sure how to do math utilizing /scoreboard. Any help, please? I've been using /scoreboard players tag up to now. I suspect I need to use a dummy objective, but am not sure how to make it work right.
Also...it's looking like I could use a really good "course" on /scoreboard, since a lot of the web pages I've found are kind of terse...and I have the feeling it's probably something I'll be making use of a *lot* in the near future.
So, any help on my "math" problem, and on a good /scoreboard learning source, would be a big help.
Thanks!
Oh. I should say I'm using Minecraft 1.12.2 right now.
Search for minecraft scoreboard command and click the minecraft wiki link. (seems to be most helpful for me...)
Setup:
/scoreboard objectives add totalArmor dummy
Do math:
/scoreboard players set @a totalArmor 0 (this resets their score)
/scoreboard players add @a totalArmor 1 {ArmorItems:[{},{},{},{id:"minecraft:iron_helmet"}]}
/scoreboard players add @a totalArmor 1 {ArmorItems:[{},{},{id:"minecraft:iron_chestplate"},{}]}
/scoreboard players add @a totalArmor 1 {ArmorItems:[{},{id:"minecraft:iron_leggings"},{},{}]}
/scoreboard players add @a totalArmor 1 {ArmorItems:[{id:"minecraft:iron_boots"},{},{},{}]}
Give effects:
/effect @a[score_totalArmor=1] regeneration 1
/effect @a[score_totalArmor_min=2,score_totalArmor=2] regeneration 2
/effect @a[score_totalArmor_min=3,score_totalArmor=3] regeneration 3
/effect @a[score_totalArmor_min=4] regeneration 4
YouTube: https://www.youtube.com/channel/UCzGDRYWcrGreMmQFo_d5N5Q
Facebook:https://goo.gl/s0r12d
Website:https://theusaf.weebly.com
JavaScript Projects: https://theusaf.github.io
Link Shortener: https://shortr.github.io
Twitter:https://www.twitter.com/theusafyt
No, I didn't test it. I'll test it later, but it does seem strange that you didn't get the score when you had only an iron helmet on.
YouTube: https://www.youtube.com/channel/UCzGDRYWcrGreMmQFo_d5N5Q
Facebook:https://goo.gl/s0r12d
Website:https://theusaf.weebly.com
JavaScript Projects: https://theusaf.github.io
Link Shortener: https://shortr.github.io
Twitter:https://www.twitter.com/theusafyt
Thanks for the replies!
I guess I probably did a poor job of explaining what I need (obviously). I figured using the item name (i.e. "minecraft:iron_boots) would be a good enough example. But let's say I have added an arbitrary tag (i.e., "REGEN:1b") to certain items. I'm trying to get an effect (or, even, cumulative effects in this case) if a player is wearing *any* armor item, they get (for example) regeneration 1...2 armor items, regen 2, etc.
Sorry about not being very clear. Though, the above info does help. I may have to do a separate command block for each particular tier of armor (leather/iron/diamond/etc). I was hoping for something a little more compact.
Thanks!
PS: I actually have that wiki link bookmarked. I think I need something with more detail to it. Thanks!
D'oh! Never mind, I figured it out. Had to use tag:{REGEN:1b} and it worked great.
Thanks!
Oh crap.
Well, the regeneration potion effect doesn't seem to work when those commands are put into command blocks. Things like JUMP_BOOST (and others) do, but not this one. The little hearts dance around, but empty hearts don't refill...until I take the armor *off*. Then as the REGEN buff timer counts down, the potion effect works.
*shrug*
Sounds like I can't just simply run that thru a repeating (always active) command block. I'd have to create a redstone timer.
a...*scoreboard* timer? You mean, outside of having a command block do the occasional scoreboard objective checking?
Huh. No idea how to do that. Hopefully I can find a good tutorial. I've seen lots of ways of making clocks with redstone and hoppers... I'll have to see what I can dredge up.
Thanks!