Just very rarely. That's why these things usually happen in schools, churches, at the movies and in nightclubs. Also, most of the shooters do end up killing themselves anyway.

The more guns you put in schools, churches, movie theaters, and nightclubs (especially in nightclubs where a lot of people get drunk), the more likely you're going to have accidental gun deaths or injuries there, far more likely than that guns in those locations will stop a mass shooting. We already know what works in other first world countries. Minimizing the number of guns minimizes the number of gun deaths.