Minecraft command execute problem + 1.9 scoreboard tag problem [duplicate]

Minecraft command execute problem + 1.9 scoreboard tag problem [duplicate] - Expressive angry businessman in formal suit looking at camera and screaming with madness while hitting desk with fist

I'm trying to make a kit pvp map in vanilla Minecraft, but I ran into a problem. I want specific people to get a certain effect. So I got a /testfor command:

/testfor @a{SelectedItemSlot:0,Inventory:[{Slot:0b,tag:{display:{Name:"Fire Wand"}}}]}

This command tests if any person has this specified item name in slot 0. It then turns on a comparator which activates the second command once it finds that person:

/execute @p ~ ~ ~ summon Fireball ~2 ~1 ~ {ExplosivePower:10,direction:[0.0,0.0,0.0]}

How can I specify this command to the person holding the named item?

So Skylinerw suggested this command which seems to solve all my problems!

You have to use a command to apply a label to the player based on their data rather than using /testfor. For example, /scoreboard can assign a label:

/scoreboard players tag @a[tag=HasItem] remove HasItem
/scoreboard players tag @a[tag=!HasItem] add HasItem {SelectedItemSlot:0,Inventory:[{Slot:0b,tag:{display:{Name:"Fire Wand"}}}]}

And you'd then target players based on their label. The correct tag for fireball damage is ExplosionPower:

/execute @a[tag=HasItem] ~ ~ ~ /summon Fireball ~2 ~1 ~ {ExplosionPower:10,direction:[0.0,0.0,0.0]}

I thought this is really cool! But how does the scoreboard command activate the execute command? Is it with a comparator? Do both command blocks have to be on a clock?



Best Answer

You're right. Both commands must be on a clock.




Pictures about "Minecraft command execute problem + 1.9 scoreboard tag problem [duplicate]"

Minecraft command execute problem + 1.9 scoreboard tag problem [duplicate] - Side view of upset male entrepreneur in formal wear sitting on couch in modern living room and contemplating about financial problems while leaning on hands and looking down
Minecraft command execute problem + 1.9 scoreboard tag problem [duplicate] - Modern Asian man in jacket and glasses looking at laptop and screaming with mouth wide opened on white background
Minecraft command execute problem + 1.9 scoreboard tag problem [duplicate] - White sculpture of Apollo with medical mask on face in bright neon light on purple background





How to target more than one Scoreboard Tag on an entity Minecraft 1.9 / 15W32




Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

Images: Andrea Piacquadio, Andrea Piacquadio, Andrea Piacquadio, Alena Shekhovtcova