1

I'm making more weapons in minecraft with command blocks. I have been able to create a bow with explosive arrows, but I can't figure out how to make it so you can shoot multiple arrows and then click with an item in your hand to explode the arrows. This would be like launching c4 with a bow. Thanks.

  • Have you tried doing anything yourself? – RookieTEC9 Jul 27 '16 at 9:32
  • @RookieTEC9 yes, I've tried to use the same concept as my other explosive arrows but I can't figure out how to find more than one of the arrows cords. – ethanflips Jul 27 '16 at 12:54
2

What you have to do is put a tag on the arrow when the player is shooting it. If you have any special requirements and tags for the player, put it in the []. If there aren't any tags, get rid of the [].

/execute @a[] ~ ~ ~ scoreboard players tag @e[type=Arrow,r=2] add c4

If you put this on a repeating command block, all arrows shot from the player will have the c4 tag.

Then, create a scoreboard called "click".

/scoreboard objectives add click stat.useItem.minecraft.carrot_on_a_stick

Just for working with it, set it to the sidebar.

/scoreboard objectives setdisplay sidebar click

Now whenever you right click with a carrot on a stick, you will add 1 to your click score.

Make a chain coming from that first repeating command block with the following commands in this order.

/execute @a[score_click_min=1,*other selectors here*] ~ ~ ~ execute @e[type=Arrow,tag=c4] ~ ~ ~ summon *whatever you need* *wherever* *NBT tags*
/execute @a[score_click_min=1,*other selectors here*] ~ ~ ~ kill @e[type=Arrow,tag=c4]
/scoreboard players set @a[] click 0

If you want to add more effects to the arrows before they are killed, use

/execute @a[score_click_min=1,*other selectors here*] ~ ~ ~ execute @e[type=Arrow,tag=c4] ~ ~ ~ *command*

and add it after the first command block. I hope this helped!

| improve this answer | |
  • This is by far the very coolest, most thorough answer I have ever seen on this site. – Caleb Woodman Jan 10 '17 at 21:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.