Hello im currently using this summon Arrow ~ ~1 ~ {damage:20,Motion:[1.0,0.9,0.0]} and all it does is shoot a arrow i need that arrow to target entities and i need a radius on the command can somebody help me out?
1
If you want to target entities from where the person is facing, you have to use raycasting. Also what do you mean by radius.
For example: "A complete raycasting function, just need to fill in the gaps for your specific use
For example: "A complete raycasting function, just need to fill in the gaps for your specific use
execute as <shooter> at @s anchored eyes positioned ^ ^ ^ anchored feet run function start_ray# start_ray.mcfunction
tag @s add ray
scoreboard players set #hit temp 0
scoreboard players set #distance temp 0
function ray
tag @s remove ray# ray.mcfunction
execute unless block ~ ~ ~ #trace_through run function hit_block
execute if score #hit temp matches 0 positioned ~-0.05 ~-0.05 ~-0.05 as @e[tag=!ray,dx=0,sort=nearest] if score #hit temp matches 0 positioned ~-0.85 ~-0.85 ~-0.85 if entity @s[dx=0] run function hit_entity
scoreboard players add #distance temp 1
execute if score #hit temp matches 0 if score #distance temp matches ..<max distance> positioned ^ ^ ^0.1 run function ray# hit_entity.mcfunction
scoreboard players set #hit temp 1
<your commands for when an entity is hit># hit_block.mcfunction
scoreboard players set #hit temp 1
<your commands for when a block is hit> "
