Why do all my vehicles exterior and interior lights flicker only when the engine is running? Has anyone experienced this difficult problem?

I have a 2004 Ford Ranger XLT FX4 Level II with a manual transmission. Sometimes the flickering lights and engine running rough are worse than other times. They both seem in sync with each other. The truck is now overcharging but I do not think it always overcharged. It is NOT the alternator, plugs that plug into the alternator, battery, grounds, belt, belt tensioner, and idler pulley. Pretty much everything that a mechanic would first check, for example: the obvious things, are all checked and good. I don't know what the problem is. It has to be something causing it.

Bad ground

Connect jumper cables from battery negative to the engine block and engine block to frame. Issue goes away, check for bad ground cable and ground points. No joy, check alternator output with a carbon pile tester.

Either a bad ground to the body from the battery negative post or a bad ground to the alternator housing.
If those are ok you need a new alternator as the one in your vehicle has "ac ripple:",\.

If it were a bad ground as others suggest, the flickering would likely happen even when the engine is not running.
I would have the alternator tested.

The truck is now overcharging but I do not think it always overcharged. It is NOT the alternator,
That Can't be true. IF overcharging is happening, it MUST be the alternator. Other issues can cause flickering, but ONLY a problem with the alternator can cause overcharging.