This is what I've got so far. The problem is that with navmesh areas that are 2 story high, the SamplePosition can only find the top layer for some reason.
Transform friendPos = fsmBehaviour.gameObject.GetComponent<vAICompanion>().friend.transform;
NavMeshHit hit;
Vector3 randomPosition;
for (int i = 0; i < 30; i++)
{
Vector3 temp = friendPos.position - Camera.main.transform.forward * 5;
temp.x += Random.Range(-5f, 5f);
temp.z += Random.Range(-5f, 5f);
randomPosition = temp;
if (NavMesh.SamplePosition(randomPosition, out hit, 2f, NavMesh.AllAreas)
&& !InView(hit.position)
&& hit.position.y < friendPos.position.y + 2f
&& !LineOfSight(hit.position, friendPos.position - Camera.main.transform.forward * 5))
{
fsmBehaviour.transform.position = hit.position;
fsmBehaviour.gameObject.GetComponent<NavMeshAgent>().ResetPath();
break;
}
}