Minecraft – How to give a player an effect when a egg is thrown

minecraft-bedrock-editionminecraft-commands

I’m trying to create a KitPvP with power-ups and I want it so that when someone with the archer kit throws an egg, it gives the person speed and strength. If there’s an add-on for it, please tell me.

Best Answer

It should be possible to do it with a command like this one:

/execute @e[type=egg] ~ ~ ~ effect @a[r=2,tag=archer] speed 10 3 true

This will give any player with the tag archer who is within a radius of 2 blocks of an egg the effect speed for 10 seconds on level 3, while not showing any particles (remove the true if you want players to see the particles).

This will work for any archer throwing an egg, but it will also give other archers who are close to an egg the same effct.

You need to put the command into an active, repeating command block for it to work.

You can chain a command block with this command to give the second effects:

/execute @e[type=egg] ~ ~ ~ effect @a[r=2,tag=archer] strength 10 3 true

And a third command block with this command to remove eggs after they were thrown, to reduce how many players may get the effect (as flying eggs also gives the effects, so throwing an egg at an archer would give both archers the effects).

/kill @e[type=egg]

There is no way for a command block to know who exactly threw the egg in minecraft pocket edition, so after setting this all up EVERY archer within a small radius of the one throwing the egg will get the effects.

This is what it may look like if you set up all 3 command blocks:

3 command blocks that will repeatingly activate, all set to <code>always active</code>.