How to detect when an arrow will hit player + detect damage
I made a datapack in which there are multiple entities hitting the same mob at roughly the exact same tick. I need every single hit to count but it's impossible due to I-frames. For arrows, I tried "execute as @a at @s if entity @e[distance=..1,type=!player] run say hi" for trying to test when an arrow would hit a player, so I can in turn run the damage command after killing the nearby arrow. But it doesn't seem to work as it doesn't trigger it before I get hit by the arrow.
Also additional question over damage_type. Is it possible to detect how much damage an arrow would have dealt, and use this in the damage ommand? Or is it only possible to deal a set amount of damage every time?