TransWikia.com

Summoning enderpearls on arrows with custom name shot by a player

Arqade Asked by user3303633 on February 25, 2021

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?

One Answer

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.

Answered by RS_Mind on February 25, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP