Lightning Bow Affecting Only Certain People

Lightning Bow Affecting Only Certain People - Man Carrying a Baby

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:

/scoreboard objectives add firedArrow stat.useItem.minecraft.bow

Repeating commands:

Have the following commands constantly repeating, in this order:

/execute @a[score_bowupgrades_min=1,score_firedArrow_min=1] ~ ~ ~ /scoreboard players tag @e[type=Arrow,c=1,r=3] add Lightning
/scoreboard players set @a[score_firedArrow_min=1] firedArrow 0
/execute @e[type=Arrow,tag=Lightning] ~ ~ ~ /summon LightningBolt

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:

/scoreboard objectives add isLightning dummy

This version will also need the objective to delay the lightning bolts, as requested in the comments:

/scoreboard objectives add lightningTimer dummy

Update your repeating commands to the following:

/execute @a[score_bowupgrades_min=1,score_firedArrow_min=1] ~ ~ ~ /scoreboard players set @e[type=Arrow,c=1,r=3] isLightning 1
/scoreboard players set @a[score_firedArrow_min=1] firedArrow 0
/execute @e[type=Arrow,score_isLightning_min=1,score_lightningTimer_min=20] ~ ~ ~ /summon LightningBolt
/scoreboard players add @e[type=Arrow,score_isLightning_min=1] lightningTimer 1



Pictures about "Lightning Bow Affecting Only Certain People"

Lightning Bow Affecting Only Certain People - Couple Sitting on the Couch
Lightning Bow Affecting Only Certain People - Senior male turner working on lathe machine in workshop
Lightning Bow Affecting Only Certain People - Black Gift Box With White Ribbon





BEST LIGHTNING BOW UPGRADE GUIDE [EASY] Black Ops 3 Zombies Der Eisendrache Easter Egg Guide Full




More answers regarding lightning Bow Affecting Only Certain People

Answer 2

I don't know if this works in 1.9.* or 1.10 due to the fact of executing an execute command on top of an execute command. Try this command

/execute @a[score_bowupgrades_min=1] ~ ~ ~ execute [type=Arrow,r=1] ~ ~ ~ summon LightningBolt

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

Images: Josh Willink, cottonbro, Andrea Piacquadio, Max Fischer