-1

I'm at my wit's end on this one. I've prowled here for solutions and found parts that helped do what I needed but it gets stuck on this specific part.

I am trying to create a string of command blocks that detects a custom item held, teleports the holder to spawn, tags them, removes 1 of the item from all tagged players, then untags them. The tags simply coming into play because all other methods I had been attempting don't work.

Simplified commands as suggested by @Fabian:

CB 1: /execute as @a[nbt={SelectedItem:{id:"minecraft:scute"}] run teleport -274 77 324

CB 2: /execute as @a[nbt={SelectedItem:{id:"minecraft:scute"}] run tag @s[nbt={SelectedItem:{id:"minecraft:scute",tag}] add skoot

CB 3: clear @a[tag=skoot] minecraft:scute 1

CB 4: execute as @a[tag=skoot] run tag @s remove skoot

The problem I am running into is CB 3, as the clear will not detect the held item or copies of it in the inventory (to check if it works at all). I can't see what I'm doing wrong on it, as the specifications are identical to the previous commands.

Any help pointing out how I can get this thing to work would be greatly appreciated.

  • Those are really long commands, try with simpler examples first. I just tried clearing an item based on its name from my inventory and it worked. But since your commands are so long, I don't see the error. Also keep in mind that syntax errors in NBT usually don't give you an error message, it just doesn't match instead. – Fabian Röling Oct 22 '18 at 20:07
  • So I finally got around to trying to simplify the commands like you suggested @Fabian. For starters I went ahead and tried to do only the default item without names. It looks like the problem could be the targeting for the clear command itself. I tried clear @a[tag=skoot] #minecraft:scute 1 and without the tag requirement but it still seems to be misbehaving. – Aloctor Oct 23 '18 at 20:28
  • Then please put that into the question, with at much detail as possible. – Fabian Röling Oct 23 '18 at 22:26
  • Went ahead and edited the question as you advised. – Aloctor Oct 24 '18 at 19:27
  • Ok, I finally started: 1. You're missing a } on all NBT selectors. But I guess you didn't have that in the game, since you would have gotten a pretty descriptive error message otherwise. Please either enter the exact commands you used in the game or use the exact commands you wrote here. Ctrl+C, Ctrl+V. Also you have a lone tag, which does nothing except giving an error message. Not sure what that's for. 3. Your check in the second command is duplicated. Just use @s the second time, or, if the tag thing is meant to be something, then @s[tag=<whatever>]. Or just leave out the… – Fabian Röling Oct 25 '18 at 19:40
0

The tag selector argument you used is invalid. Selector arguments are always in the form <key>=<value>, you only gave it a key. You have to either specify what tag you want (like tag=superDuperTagName) or just leave it out.

Also, if you get error messages, always make sure to include it in the question. That and reducing the commands to the minimal reproducing example speeds up getting answers a lot!
For example in this case, your command #2 (with the fixed closing curly brackets) has surely given you the error message "Expected ':' ...scute",tag}}] add skoot<--[HERE]".

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.