Next time, please inform us what you have already tried.
I have been working on a solution for a few hours, this question quite intrigued me.
However, I have been unable to find a way to get it to work in 1.10.X
A solution is to use 1.13.X where they have introduced the new relative notation - the caret (^)
First, set up a scoreboard looking at minecraft.used:minecraft.diamond_sword
/scoreboard objectives add Sword minecraft.used:minecraft.diamond_sword
Next,
/execute if score @p Sword matches 1 run execute as @a at @s anchored eyes run particle minecraft:sweep_attack ^ ^ ^2 0 0 0 0.01 20 force
This looks for if the player has used a sword
Next go all of the particle command blocks (in your case, 5)
All command blocks to be chain, and conditional
/execute at @a[scores={Sword=1}] run particle minecraft:sweep_attack ^ ^ ^2 0 0 0 0.01 20 force
At the end, the last conditional chain command block
scoreboard players set @a Sword 0
Hope I helped - I spent a couple of hours working on this.
Feel free to reply if you need anything or any changes.
The best way to do this would be to use a scoreboard tag. The scoreboard command, like testfor, can search for entities with partial nbt matches, but can also mark them for other commands.
/scoreboard players tag @e[type=spider] add SpiderMark {ActiveEffects:[{Id:12b}]}
If you use this all spider's with fire resistance will receive the "SpiderMark" tag. Then you can add the tag=SpiderMark
to the entity selector in the particle command to only play the particle command off spider's with fire resistance.
/execute @e[type=spider,tag=SpiderMark] ~ ~ ~ particle flame ~ ~1 ~ 1.5 1 1.5 0 3 normal @a
Best Answer
I don't think it's possible directly, but you can use a dummy entity, like an invisible marker armour stand. Summon it at one player and then use a command like this one:
The copies the y coordinate from the NBT of the player to the NBT of the entity, therefore teleporting it to that player's height. You can then use the coordinates of that entity for your other commands and afterwards kill the dummy entity again.