I always heard that the gun thing was because Harrison Ford was ill and just wanted to end the scene. And that originally he was supposed to fight the sword guy with his whip
As the whip versus sword scene was being planned on set, it was becoming too complicated and time consuming for a famously time and budget conscious production. Harrison Ford then suggested using his gun. Problem solved, to the relief of Ford and many others on the set suffering from dysentery.