The shooter...well he wasnt complying with the laws.
By the nature of a "criminal act" -- that's always going to be the basic problem. There's no way around that one...
The bottom line: mass murderers choose their victims carefully, they are insane, but not stupid. All mass shootings mentioned in the OP happened in “gun-free zones”. Question: what solution would work better
1. Expand the “gun-free zones” to entire country.
2. Get rid of “gun-free zones” altogether.
I think that the answer is obvious: remove an incentive to the crime, i.e. stop disarming people capable of defending themselves!