-1

I'm attempting to make an adventure map but I got a little stuck with the commands.

I'm trying to make it when I put on a named leather helmet other players in the game will get the potion effect glowing. Anyone who knows a little commands probably know how to do this but I'm a noob so please help me.

I attempted to use scoreboards making it when player is where a helmet set a dummy scoreboard to 1 and then test for players with the score one and if it gets that going into a chain command block then to effect player with the score of 0 but that didn't work any ideas of how I can fix it.

  • 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 Dec 24 '17 at 1:00
2

Here is a solution that adds a scoreboard tag to any player wearing a leather helmet named Test. This tag is then used to target only the other players and apply the effect. Commands are for 1.12.2.


Use 2 command blocks in a chain.

The first command block is RepeatUnconditionalAlways Active with command:

scoreboard players tag @a remove Wearing

The second command block is ChainUnconditionalAlways Active with command:

scoreboard players tag @a add Wearing {Inventory:[{Slot:103b,id:"minecraft:leather_helmet",tag:{display:{Name:Test}}}]}

Now you can use that tag to target the players who are not currently wearing the leather helmet by adding it to the target selector. By using the execute command, the command will only run if at least one person is wearing the leather helmet. As soon as a single player puts on the helmet, all other players will have the glowing effect.

One more command block. It is another RepeatUnconditionalAlways Active with command:

execute @a[tag=Wearing] ~ ~ ~ effect @a[tag=!Wearing] minecraft:glowing 1 255 true
  • No problem at all. If you build the system and it solves your problem, click the checkmark next to the question. This signals future readers who may have similar problems that this answer helped with this problem. If on the other hand, it does not help or work, edit your question with the new information so others can answer and get you to a solution that works for you. – IronAnvil Dec 24 '17 at 6:05

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.