5

I want to shoot an arrow named "GreenArrow" that constantly summons enderpearls named "GreenPearl". Those pearls should execute a command at armorstands within 1 block. That command is /setblock ~ ~-1 ~ wool 5.

To do this, I have 4 command blocks, and 2 dummy scoreboard objectives. the dummy objectives are as follows:

/scoreboard objectives add GreenArrow dummy
/scoreboard objectives add GreenPearl dummy

The 4 command blocks that are repeating and always active, are as such:

/scoreboard players set @e[type=arrow] GreenArrow 1 {CustomName:"GreenArrow"}

/execute @e[type=arrow,score_GreenArrow_min=1] ~ ~ ~ summon ender_pearl ~ ~ ~ {CustomName:"GreenPearl"}

/scoreboard players set @e[type=ender_pearl] GreenPearl 1 {CustomName:"GreenPearl"}

/execute @e[type=ender_pearl,score_GreenPearl_min=1] ~ ~ ~ execute @e[type=armor_stand,r=1] ~ ~ ~ setblock ~ ~-1 ~ wool 5

This works when the arrow us summoned using this command,

/summon arrow ~ ~80 ~ {CustomName:"GreenArrow"}

but not when shot by a player. I have tested with a arrow with the custom name in it's NBT data and when renamed in a anvil.

The arrow is shot just fine, but is not detected by the command blocks unless summoned as previously mentioned.

I do belive it has something to do with the way the arrow is shot, in creative mode or survival/adventure there is no difference. It seemes like the arrow looses it's NBT data after being fired from a bow. There were no issues with this before the CustomName was added.

Are anyone here able to assist?

  • I found out that I need to use /entitydata, but not sure where. Tried adding it to this command: /scoreboard players set @e[type=arrow] GreenArrow 1 {CustomName:"GreenArrow"} so that command now looks like this: /scoreboard players set /entitydata@e[type=arrow] GreenArrow 1 {CustomName:"GreenArrow"}. I am not familiar with this command, and not sure how to properly use it. – user3303633 Dec 14 '16 at 1:39
  • 1
    It might be best to also name the bow something special. That way, you can test if the player is holding the named bow, then apply the name to the just shot arrow. – MBraedley Dec 14 '16 at 2:24
  • I don't see how this got necro'd – Kingsley Zhong Jul 11 '17 at 17:18
0

You cannot do this specifically, but what you can do is have the player hold the arrow in their off hand (like potion arrows) and set a score to 1, then use the command

/execute @a[score_SCORENAME_min=1] ~ ~ ~ scoreboard players set @e[type=Arrow,r=1] GreenArrow 1.

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.