A character model which is more than 5" from a friendly unit of five or more models can be shot at without any restrictions. Characters who are prone to jumping up and down right in front of the enemy are just asking to get killed, so it serves them right if they get shot!
A character model within 5" of a friendly unit of five or more models can only be picked out as a target if he is the closest legal target. This restriction enables characters to move around behind the battlelines without attracting an unrealistic and unreasonable amount of missile fire. Note that if the character is riding a horse or similar mount then he can still be singled out as a target if all friendly units within 5" are infantry. The same applies if the character is riding a monster or is much larger than any friendly units within 5".
If a character is part of a unit which consists of at least five rank-and-file models of similar size in total then he cannot be shot at. Any shots against the unit will hit ordinary troopers and not the character. If the unit drops in size to less than five rank-and-file models, then further hits are allocated before rolling to wound. Divide the number of hits evenly between all the members of the unit (including the characters), and randomise any excess hits. If the number of hits the unit suffers is smaller than the number of models in a unit, randomise which models are hit.
So, for example, if a unit with three rank-and-file models and two characters suffered seven hits, then each model would suffer a single hit, and you would roll to wound and take saves immediately. Allocate the remaining two hits between any survivors randomly.