Hey man, just stumbled upon this while trying to do the opposite of you. Hope you have figured this one out already, but if not. And for anyone that tries to attempt this, you can do it like the following;
- Do a Donut: Generate items around Querier
- Check distance to Querier and get the minimum value with a scoring factor of -1; this will result in your AI preferring a target closer to it.
- Create an Environment Query Context that returns all players (or a specific target if you prefer) and do trace test against it; this is what will actually check if the position provides cover (or has Line of Sight) to target or not
PS. on a side note, you might want to set it to just score as opposed to filter and score otherwise there may be a situation where all the positions fail.
Your final EQS should look something similar to the below; this should result in a behavior where the AI prefers a location closest to it with cover.
This is a very crude and simple method, you can tweak the values as you require.