# Create marker
summon area_effect_cloud ~ ~ ~ {Tags:["multiple_wave","attack","EB","init","unspellable","mrcd_bullet","1","nonlocking"],Duration:60}
summon area_effect_cloud ~ ~ ~ {Tags:["multiple_wave","attack","EB","init","unspellable","mrcd_bullet","2","nonlocking"],Duration:60}
summon area_effect_cloud ~ ~ ~ {Tags:["multiple_wave","attack","EB","init","unspellable","mrcd_bullet","3","nonlocking"],Duration:60}
summon area_effect_cloud ~ ~ ~ {Tags:["multiple_wave","attack","EB","init","unspellable","mrcd_bullet","4","nonlocking"],Duration:60}
summon area_effect_cloud ~ ~ ~ {Tags:["multiple_wave","attack","EB","init","unspellable","mrcd_bullet","5","nonlocking"],Duration:60}
execute at @s anchored eyes positioned ^ ^ ^ run tp @e[tag=multiple_wave,tag=1,tag=init,limit=1] ~ ~ ~ ~-40 0
execute at @s anchored eyes positioned ^ ^ ^ run tp @e[tag=multiple_wave,tag=2,tag=init,limit=1] ~ ~ ~ ~-20 0
execute at @s anchored eyes positioned ^ ^ ^ run tp @e[tag=multiple_wave,tag=3,tag=init,limit=1] ~ ~ ~ ~ 0
execute at @s anchored eyes positioned ^ ^ ^ run tp @e[tag=multiple_wave,tag=4,tag=init,limit=1] ~ ~ ~ ~20 0
execute at @s anchored eyes positioned ^ ^ ^ run tp @e[tag=multiple_wave,tag=5,tag=init,limit=1] ~ ~ ~ ~40 0
tp @e[tag=multiple_wave,tag=init,limit=5] ~ ~.1 ~
execute as @e[tag=multiple_wave,tag=init,limit=5] at @s run tp @s ^ ^ ^.5

# Save speed and direction
execute as @e[tag=multiple_wave,tag=init,limit=5] store result score @s mrcd_x0 run data get entity @s Pos[0] 1000
execute as @e[tag=multiple_wave,tag=init,limit=5] store result score @s mrcd_z0 run data get entity @s Pos[2] 1000

execute store result score #var0 mrcd_system run data get entity @s Pos[0] 1000
execute store result score #var2 mrcd_system run data get entity @s Pos[2] 1000

scoreboard players operation @e[tag=multiple_wave,tag=init,limit=5] mrcd_x0 -= #var0 mrcd_system
scoreboard players operation @e[tag=multiple_wave,tag=init,limit=5] mrcd_z0 -= #var2 mrcd_system

# Clear tag
tag @e[tag=multiple_wave,tag=init,limit=5] remove init

playsound block.grass.break hostile @a ~ ~ ~ 1 .5
