So... the first idea I have is to cast an invisible (and very fast) projectile spell directly forward, check who/if the target actor is in the spell effect script, then send the value back to the original script somehow.
I have some questions about this though:
(1) The wiki says the cast function will cast the spell in a "default direction" if a target is not specified. Is this always the direction that the player is facing?
(2) If not, what is the best way to cast it in that direction? My idea is to place a marker object in front of the player's view and cast at that, but the math + placement functions seem like they'd take a lot of extra time.
(3) What is the best way to give the spell's target actor back to the original script? The things I can think of are: have form list property of both scripts, and temporarily put the actor into it, or use a global variable or some dummy actor and put the formID in there. Since it only needs to be accurate for less than a second, I'm not too worried about the formID changing or anyway, but I'm worried about how to know when the value is ready to be accessed? It seems kind of silly to just loop at 1ms intervals or something to check if the value has been set yet...