3

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?

2
  • Can I clarify what you mean by "only affect those who have bowupgrades"? Who has this tag? The people using the bow or those being hit by the arrows?
    – Ben
    Jun 14, 2016 at 23:32
  • @Ben People with bowupgrades at a score of 1 have the lightning bow. those with a bowupgrades score of 0 are stuck with the normal bow.
    – gamer103
    Jun 15, 2016 at 22:06

2 Answers 2

3
+50

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
15
  • one question(although i know this wuz not in the orignial question). is their any way to make it so that lightning rapidly strikes the arrow after one second of the player firering? i have realized that with the lighting bow if you do not delay the lighting by one second the lightining damages u as the arrow flys away.
    – gamer103
    Jun 21, 2016 at 1:25
  • if their is no way to do this tell me and i will give u ur rep.
    – gamer103
    Jun 21, 2016 at 1:26
  • @gamer103 Create a new dummy objective called lightningTimer (/scoreboard objectives add lightningTimer dummy), add /scoreboard players add @e[type=Arrow,tag=Lightning] lightningTimer 1 to the end of your clock, and then change the third command to /execute @e[type=Arrow,tag=Lightning,score_lightningTimer_min=20] ~ ~ ~ /summon LightningBolt
    – SirBenet
    Jun 21, 2016 at 9:28
  • it still affects everyone. not just those with a bowupgrade score of 1. PLEASE FIX THIS FAST FOR I NEED THE ANSWER BEFORE TOMMOROW.(June 26,sunday)
    – gamer103
    Jun 25, 2016 at 14:31
  • @gamer103 Works fine for me, probably something wrong with your setup. Are you using a very outdated Minecraft version? Are you sure that you've entered all the commands correctly? Are all of the commands being activated, and in the right order? A screenshot could help work out what's wrong.
    – SirBenet
    Jun 25, 2016 at 15:05
1

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
2
  • it does not work. whenever i try running it i get the fail message of "[16:12:35] Failed to execute 'execute [type=Arrow,r=1] ~ ~ ~ summon LightningBolt' as Grostic403" (Grostic403 is my username).
    – gamer103
    Jun 15, 2016 at 22:13
  • can u fix this answer quick cuz i need it very soon or i'm screwed.
    – gamer103
    Jun 17, 2016 at 18:54

You must log in to answer this question.

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