If you have a Sorcerer with Spell Sniper and Distant Spell, you have just gained the ability to cast Scorching Ray at a 480ft range.
Let's assume you found a sniper's perch at this distance, and there is a clear line of sight from you to your targets. You now begin an assault by casting Scorching Ray at this crazy far range.
A "sniper's perch" means you have the optimal conditions for firing a long distance shot and taking cover afterwards. You have a line of sight to the target, as well as the ability to gain total cover by using only a small amount of movement -- possibly requiring none, even, as you might only need to crouch.
The PHB (pg194-195) states:
Unseen Attackers and Targets
[..] If you are hidden--both unseen and unheard--when you make an attack, you give away your location when the attack hits or misses.
The question is, when you cast this spell, do you count as an unseen and unheard attacker? Do you give away your position?
At a distance this far, would taking the Hide action still benefit you, or would you still have to take the Hide action after your first Scorching Ray to remain hidden?
Clarification On Being Hidden
Let's say you somehow were able to hide in the same turn--you cast Haste on yourself or something--but you stayed in your perch, what does that mean for the targets? Do they suddenly forget your position?
Does it go like this when you don't hide:
- Cast Scorching Ray at distance
- Duck behind total cover
- Become unseen, but enemies know where your perch is
And like this when you hide:
- Cast Scorching Ray at distance
- Take hide action
- Become hidden, enemies now do not know where your perch is, but they can guess
And what of this scenario, say you didn't have Haste?
- Cast Scorching Ray at distance
- Take cover but do not hide, enemies now know your position
- Initiative roll
- Hide, but do not move (enemies lose your scent? you are still in the same square as before)
- Wait for your next turn
- Cast Scorching Ray at distance
The Question of Distance
I chose to use a long distance here because it makes sense that hiding from further away should be easier than when you're 60ft away. When you're at 480ft away, you do not have to move much to gain total cover, and any slight sounds you make while gaining cover again cannot reasonably said to be heard by the targets.
Whereas, if you're only 60ft away, you are within range of the target, so you must move constantly to stay out of reach, and so being forced to take the Hide action makes sense at that distance.
Normal Sniping Distance for US Police
I know this is a fantasy game, and putting it in perspective of real life mechanics is not always the best approach. Still, it seems useful at least to have some sort of grounds for comparison, and typical real life sniper distances can ground us as to how sniping works.
That said, this is an excerpt from a legitimate-looking article on the internet. It is a report of 219 sniping incidents from 1984 to 2004 in the US. The same study is referenced in another legitimate-looking article on the internet.
The average police sniper distance was 51 yards. Of all the sniper shots, 95% took place between zero and 100 yards. The rest were equally divided between the 100 to 150 yard bracket and the 150 to 250 yard bracket. This has profound training implications.
Basically, sniping from 480ft or 160 yards would be in the upper 2.5% of real life incidents in the US. Not bad for a spell sniping sorcerer, and also lending credibility to the fact that you can snipe at this distance.