I know the command:
/execute @e[type=Arrow,c=1] ~ ~ ~ summon LightningBolt
But I want to know how to make this command only affect certain people. I have a scoreboard objective set up called "bowupgrades" and I want the lightning bow command to only affect those who have "bowupgrades" with a score of 1 (default is 0). How do I do this?
Best Answer
Setup:
Create an objective to keep track of when players fire an arrow:
Repeating commands:
Have the following commands constantly repeating, in this order:
This makes it so when a player with
bowupgrades >= 1
fires an arrow, they put a "Lightning" tag (1.9+, use objectives for 1.8 or lower) on the arrow, which then makes the arrow constantly summon lightning.1.8 compatible
Create an additional objective to keep track of arrows that are lightning, rather than using a tag:
This version will also need the objective to delay the lightning bolts, as requested in the comments:
Update your repeating commands to the following: