#Detecting when an arrow shoots a mob

1 messages · Page 1 of 1 (latest)

keen vector
#

I've coded a datapack that makes an arrow explode when it lands. However, when hitting a mob it of course doesn't explode. How could I fix this? Right now my code is:
execute as @e[type=arrow,nbt={inGround:1b}, tag=explosive_arrow] at @s run function pack:explode
tag=explosive arrow is added if it is shot from a bow with a custom enchant, and pack:explode just summons a creeper with fuse 0

rose thornBOT
#

<@&1201956957406109788>

Someone will come and help soon!

💬 While you wait, take this time to provide more context and details.

                        🙇 After a while, hit the Summon Helpers button to ping the helper team. They'll be happy to help you


                        
                        ✅ Once your question has been resolved (or you no longer need it), please click Resolve Question or run /resolve
#
⚠️ You already have a question open!

Don't forget to close or resolve your old questions once you're done with them. It makes our lives much easier! :D

Open question: #1258813614962380900

loud robin
#

Arrows that hit a mob instantly disappear as soon as they make contact, making it a lot more difficult to detect.

#

There are workarounds for this, such as having an invisible armor stand that constantly rides any arrow with the tag=exposive_arrow and checking if its still riding an arrow constantly.

if its not riding an arrow, that would have to mean that it hit a mob, and from there you can run the command.

jade atlas
#

for that you can use custom tipped arrows. lets say you give the player an arrow with luck (an unused enchantment) level 7, which lasts 1 ticks. You can just execute an explosion command at every entity with the luck effect level 7 since there is no other way to obtain it. This will also let you have normal arrows as well as expldoing arrows. Hope this helps.

soft light
#

Which version are you on?

keen vector
tranquil yacht
#

I'm not sure enchantments can help much here, unless there's a feature of them that I'm not aware of

keen vector
#

Is there a way to do this without armour stands?

rose thornBOT
# rose thorn <@&1201956957406109788>

<@&1166082198152159386> <@&1202694677766348840>

**🙇 Helpers Arise!**

Please note that you still might not immediately get a response since all helpers are human beings and volunteers (and also might be sleeping right now)

quartz mango
#

Well a Marker or something would be better

#

tipped arrows like was suggested would be another method

#

But of course that requires ticking as all possible entities that could get hit to detect if they have that effect

keen vector
#

I am already ticking all entities for the arrow in ground

quartz mango
#

Well there ya go then.

keen vector
#

Is there a way to hide the effect in the arrow description?

whole oracle
#

Isn't there NBT data for how many arrows a mob has on it?

quartz mango
#

And I don't think there's NBT for that

tranquil yacht
tranquil yacht
keen vector
#

Okay

#

What would the code for that look like?

tranquil yacht
#

Well you're already giving the arrow a custom tag right?

keen vector
#

Yes

tranquil yacht
#

So just extend that code to add the effect to the arrow

#

Or use the marker method