1

I have been trying to use command block to make custom named arrows that summon lightning at the spot they strike. What I want to do is shoot an arrow named 'vajra', and when it strikes the ground, lightning strikes the spot a few times. I want this to happen to only the arrows named 'vajra'. Whatever command I have been trying to use until now executes on all arrows. The nearest I got to executing a command on a custom named entity was on custom named mobs; I can cause lightning to summon on a custom name mob with a certain name, however, the same code does not work for arrows.

Can someone tell me the code to capture this task?

1 Answer 1

2

Named arrows don't keep their name data after being shot, so you would have to use data from a tipped arrow in specifying where to summon lightning.

I am using a custom potion color so the item can't be crafted, and this color would be kept in the arrow entity data.

/give @p tipped_arrow{CustomPotionColor:16776960,CustomPotionEffects:[{Id:15,Duration:1,Amplifier:0}],display:{Name:'[{"text":"vajra"}]'}} 1

Then you can use a selector to summon lightning at arrows with this custom color.

/execute at @e[nbt={Color:16776960,inGround:1b}] run summon minecraft:lightning_bolt
1
  • 1
    Wow this is a neat solution, what I did instead was to use scoreboard objectives to make a lightning bow instead, all arrows shot from it are lightning arrows. Jun 20, 2021 at 6:15

You must log in to answer this question.

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