0

I'm working on a PVP map that I have posted to pmc so random people can download it and play it with their friends. My problem is, each kit has a special buff (potion effect) but when they die it leaves them.

I need this to make kinda like a loop that when they have like some armor on when they die it will test for that armor and give more potion effects.

5
  • 1
    Please be more direct on what you want help on, it's impossible to understand what you want us to do. Oct 28, 2017 at 0:17
  • I agree, more details are needed. What exactly is in the kit? What is a buff? A renamed potion or renamed armor or ...? You would like to test for specific armor at the time of the players death and apply an effect if they are wearing it? Take your time to make sure you ask a concise question.
    – IronAnvil
    Oct 28, 2017 at 3:12
  • ok so like i have a leather chestplate called "heros tunic" and i want the command to testfor if somebody is wearing that named piece of armor. and then that player specificaly will get a loop of the potion effect so when they die they will get it right back if you can help thx.
    – wolfonix
    Oct 28, 2017 at 3:13
  • When would this loop end? Currently, it sounds as though, if they are ever tested to be wearing the armor, they would have an effect forever after that. Is that what you want?
    – IronAnvil
    Oct 28, 2017 at 4:16
  • forever untill like you use effect @p clear
    – wolfonix
    Oct 28, 2017 at 16:40

2 Answers 2

2

Here is a solution that will give anyone wearing a leather chestplate named Hero's Tunic the tag Wearing. This tag can then be used to target that person for the effect. Commands are for 1.12.2.

Note: Using only these commands, if a player ever wears the chestplate, they will be tagged and the effect will be applied forever, even if no longer wearing the chestplate. (unless the tag is manually removed via a command)


Make command block that is RepeatUnconditionalAlways Active with command:

scoreboard players tag @a add Wearing {Inventory:[{Slot:102b,id:"minecraft:leather_chestplate",tag:{display:{Name:"Hero's Tunic"}}}]}

Here is an example command that gives them a level 2 slowness effect for 1 second. This will be a constant effect if the command is placed into a RepeatUnconditionalAlways Active command block:

effect @a[tag=Wearing] minecraft:slowness 1 2

To remove the tag from a player:

/scoreboard players tag <player_name> remove Wearing

Replace <player_name> with the name of the player that you want to remove the tag from.


To remove the tag from all players:

/scoreboard players tag @a remove Wearing

Edit: Response to comments.

To have more tags for more pieces of armor you would change the first command:

scoreboard players tag @a add <tagName> {Inventory:[{Slot:102b,id:"minecraft:leather_chestplate",tag:{display:{Name:"..."}}}]}

Replace <tagName> with whatever name you like. You could use numbers if wanted. (Wearing1, Wearing2, etc) You could also use other names that describe whatever you like.
Example: WearingHerosTunic You can use a different tag for each different chest plate.

Then use those tags in the other commands:

effect @a[tag=WearingHerosTunic] minecraft:slowness 1 2
7
  • thx so much this really helped sorry for the confusion.
    – wolfonix
    Oct 28, 2017 at 12:35
  • so also with this command:effect @a[tag=Wearing] minecraft:slowness 1 2 could you like make it give the potion effect if the player is wearing that specific named item because i have to make fourteen of these and they just turn each other on. if you can help thx
    – wolfonix
    Oct 28, 2017 at 14:58
  • So you only want the effect if they are wearing the armor? You had mentioned the potion effect being applied after a death, that is where the confusion comes in. You said you have to make 14 of these. What do you mean? Fourteen different named armor? Why? Fourteen different effects?
    – IronAnvil
    Oct 29, 2017 at 3:06
  • effect @a[tag=Wearing itemname: heros tunic] minecraft:slowness 1 2 i need something like this if it is possible.
    – wolfonix
    Oct 29, 2017 at 19:03
  • Do you want the effect to wear off if they take off the armor or do you just need 14 different tags?
    – IronAnvil
    Oct 30, 2017 at 3:48
-1

Well, honestly it’s quite simple, this might not work on Java but I do know it works on bedrock

/execute @a[nbt={Inventory:[{id:”minecraft:diamond_sword”}]}] ~~~ /effect @s slowness 1 2 true

Because the @s is there it will effect the player with the item(s) only

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .