In the several minutes it would take a body of advancing troops to advance through the danger zone of a smoothbore musket armed defender the attackers could expect to take several volleys, possibly three or four. Only those delivered below about 60-75 yards however would be capable of dealing great damage.
I thought I'd comment on this since I'm reading a book on this very subject right now. There is an interesting passage about how the effectiveness and accuracy of small arms fire would often
decrease as the combatants got closer to each other, entirely due to psychological reasons. I'll quote the passage here:
It is probably difficult for the modern mind to conceive of how the attackers could continue to attack, once the defenders began to fire at anything closer than a medium range. It is natural to assume that the danger of being hit with musket fire increased directly as the distance between the attacker and defender decreased. However, Colonel Bugeaud in his perspicacious notes to young officers, assures us that once a firefight had begun at a relatively long range, casualties would actually drop off in the final moments as the two groups of combatants neared one another.
If the defender had begun firing at long range, let's say at around 300 paces, their volleys would initially cause increasing casualties as the attackers advanced. This increase of casualties continued until the attacker was about 100 to 150 paces away and then the rate of casualties would actually start to decline. As the attackers approached, the individual defenders would tend to become increasingly nervous and there would be an increasing degree of confusion as the soldiers struggled to load and deliver their pieces.
Casualties during the last moments tended to be 'trifling at the moment of grappling with the enemy'. The result was that, if the attackers managed to reserve their fire until they reached close quarters, and the defenders had already begun to fire, the attackers stood an extremely good chance of overthrowing the defending line.
This is from the book "With Musket, Cannon and Sword: Battle Tactics of Napoleon and His Enemies" by Brent Nosworthy. A great deal of the book is about how psychology and morale tends to decide battles rather than the technical qualities of the weapons themselves. A disciplined force in good order will usually beat one that is not.
Smoothbore muskets are not that inaccurate, and a good marskman can hit targets 150 yds away on a firing range. There is some weapon accuracy data for smoothbore muskets in this book, from experiments conducted in Britain and France. One experiment suggested:
At 100 yds, hit chance was 53% for veteran troops, 40% for raw troops.
At 200 yds, hit chance was 30% for veteran troops, 18% for raw troops.
At 300 yds, hit chance was 23% for veteran troops, 15% for raw troops.
This all goes out the window in combat though, as we all know. Another quote: "One contemporary historian noted that the Prussians at the Battle of Czaslau had to expend 650,000 cartridges to inflict about 6,500 Austrian casualties (i.e. a 1% casualty rate). This turns out to be a high estimate of the flintlock's effectiveness. Guibert felt, for example, that only 2,000 out of 1,000,000 (0.2%) of all shots resulted in some casualty, while Piobert thought it was necessary to fire between 3,000 and 10,000 (0.01% to 0.03%) shots to effect a single hit."
At Vitoria, the British were only able to inflict one casualty for every 800 rounds fired. The accounts of some of these battles describe complete pandemonium, chaos and confusion, with men firing completely haphazardly, sometimes at their own men, and often with so much smoke you might see nothing at all in front of you except muzzle flashes and the glint of bayonets, even with the enemy only 20 yds away.
It's impossible to imagine what these battles must have actually been like. I thought SoW Gettysburg did a pretty good job simulating casualty rates, but I don't think it modeled morale very well. Waterloo seems to do morale a bit better but I think the casualty rates are too high.